From 12407cea193f304963dc9ab85f61091743008aa9 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Thu, 17 Feb 2011 22:07:18 +0000 Subject: [PATCH] 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 --- includes/libs/JavaScriptDistiller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 -- 2.20.1