Functional part of r103978 (d'oh!) plus an update to the ResourceLoader filter cache...
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 22 Nov 2011 23:20:50 +0000 (23:20 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 22 Nov 2011 23:20:50 +0000 (23:20 +0000)
includes/libs/JavaScriptMinifier.php
includes/resourceloader/ResourceLoader.php

index baf9338..976c02f 100644 (file)
@@ -498,19 +498,17 @@ class JavaScriptMinifier {
                                ctype_digit( $ch )
                                || ( $ch === '.' && $pos + 1 < $length && ctype_digit( $s[$pos + 1] ) )
                        ) {
-                               $end += strspn( $s, '0123456789', $end );
+                               $end += strspn( $s, '0123456789', $end, 1 );
                                $decimal = strspn( $s, '.', $end );
                                if ($decimal) {
-                                       if ( $decimal > 2 ) {
-                                               return self::parseError($s, $end, 'The number has too many decimal points' );
-                                       }
-                                       $end += strspn( $s, '0123456789', $end + 1 ) + $decimal;
+                                       // If there are multiple decimal points, we only deal with the first one.
+                                       // A following identifier is illegitimate after a raw . but a . and a property? Legit.
+                                       // @fixme elsewhere in the code, if we find an identifier right after this - throw a parse error
+                                       $end++;
+                                       $end += strspn( $s, '0123456789', $end );
                                }
-                               $exponent = strspn( $s, 'eE', $end );
+                               $exponent = strspn( $s, 'eE', $end, 1 );
                                if( $exponent ) {
-                                       if ( $exponent > 1 ) {
-                                               return self::parseError($s, $end, 'Number with several E' );
-                                       }
                                        $end++;
                                        
                                        // + sign is optional; - sign is required.
index 17acbd6..f64cef7 100644 (file)
@@ -29,7 +29,7 @@
 class ResourceLoader {
 
        /* Protected Static Members */
-       protected static $filterCacheVersion = 5;
+       protected static $filterCacheVersion = 6;
        protected static $requiredSourceProperties = array( 'loadScript' );
 
        /** Array: List of module name/ResourceLoaderModule object pairs */