Resolves issue in r80656 where escaped quotes within strings are not handled properly...
authorTrevor Parscal <tparscal@users.mediawiki.org>
Mon, 24 Jan 2011 19:47:57 +0000 (19:47 +0000)
committerTrevor Parscal <tparscal@users.mediawiki.org>
Mon, 24 Jan 2011 19:47:57 +0000 (19:47 +0000)
includes/libs/JavaScriptDistiller.php

index 6db1e73..c15d870 100644 (file)
@@ -32,8 +32,8 @@ class JavaScriptDistiller {
        private static function stripComments( $script ) {
                $parser = self::createParser();
                // Remove comments
-               $parser->add( '/\\/\\/[^\\r\\n]*[\\r\\n]/' );
-               $parser->add( '/\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\//' );
+               $parser->add( '/\'([^\'\\\\]*(\\\\.[^\'\\\\]*)*)\'/', '$1' );
+               $parser->add( '/"([^"\\\\]*(\\\\.[^"\\\\]*)*)"/', '$1' );
                // Execute and return
                return $parser->exec( $script );
        }