From: Roan Kattouw Date: Thu, 17 Feb 2011 22:07:18 +0000 (+0000) Subject: Fix for r82344, which causes JSDistiller to stop minifying comments because it though... X-Git-Tag: 1.31.0-rc.0~31944 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=12407cea193f304963dc9ab85f61091743008aa9;p=lhc%2Fweb%2Fwiklou.git Fix for r82344, which causes JSDistiller to stop minifying comments because it thought they were regexes. Make the regex regex a little bit stricter again, forbidding a regex from starting with * and other invalid things that were disallowed prior to r82344 (but still dropping / ) and forbidding multiline regexes --- diff --git a/includes/libs/JavaScriptDistiller.php b/includes/libs/JavaScriptDistiller.php index 6b777424d0..a5aae1e5ca 100644 --- a/includes/libs/JavaScriptDistiller.php +++ b/includes/libs/JavaScriptDistiller.php @@ -80,8 +80,8 @@ class JavaScriptDistiller { $parser->add( '/\'([^\'\\\\]*(\\\\.[^\'\\\\]*)*)\'/', '$1' ); $parser->add( '/"([^"\\\\]*(\\\\.[^"\\\\]*)*)"/', '$1' ); // Protect regular expressions - $parser->add( '/[ \\t]+((\\/[^\\/\\\\]*(\\\\.[^\\/\\\\]*)*\\/(i|g)*))/', '$1' ); - $parser->add( '/([^\\w\\$\\/\'"*)\\?:](\\/[^\\/\\\\]*(\\\\.[^\\/\\\\]*)*\\/(i|g)*))/', '$1' ); + $parser->add( '/[ \\t]+((\\/[^\\r\\n\\*][^\\/\\r\\n\\\\]*(\\\\.[^\\/\\r\\n\\\\]*)*\\/(i|g)*))/', '$1' ); + $parser->add( '/([^\\w\\$\\/\'"*)\\?:](\\/[^\\r\\n\\*][^\\/\\r\\n\\\\]*(\\\\.[^\\/\\r\\n\\\\]*)*\\/(i|g)*))/', '$1' ); // Remove comments $parser->add( '/\\/\\*(.|[\\r\\n])*?\\*\\//' ); // Preserve the newline after a C++-style comment -- bug 27046