Index: trunk/phase3/tests/phpunit/includes/libs/JavaScriptMinifierTest.php |
— | — | @@ -84,6 +84,13 @@ |
85 | 85 | // And also per spec unicode char escape values should work in identifiers, |
86 | 86 | // as long as it's a valid char. In future it might get normalized. |
87 | 87 | array( "var Ka\\u015dSkatolVal = {}", 'var Ka\\u015dSkatolVal={}'), |
| 88 | + |
| 89 | + /* Some structures that might look invalid at first sight */ |
| 90 | + array( "var a = 5.;", "var a=5.;" ), |
| 91 | + array( "5.0.toString();", "5.0.toString();" ), |
| 92 | + array( "5..toString();", "5..toString();" ), |
| 93 | + array( "5...toString();", false ), |
| 94 | + array( "5.\n.toString();", '5..toString();' ), |
88 | 95 | ); |
89 | 96 | } |
90 | 97 | |
Index: trunk/phase3/includes/libs/JavaScriptMinifier.php |
— | — | @@ -501,8 +501,8 @@ |
502 | 502 | $end += strspn( $s, '0123456789', $end ); |
503 | 503 | $decimal = strspn( $s, '.', $end ); |
504 | 504 | if ($decimal) { |
505 | | - if ( $decimal > 1 ) { |
506 | | - return self::parseError($s, $end, 'The number has several decimal points' ); |
| 505 | + if ( $decimal > 2 ) { |
| 506 | + return self::parseError($s, $end, 'The number has too many decimal points' ); |
507 | 507 | } |
508 | 508 | $end += strspn( $s, '0123456789', $end ) + 1; |
509 | 509 | } |