From e519eadc99216916201371745ac61efd50473762 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Thu, 17 Feb 2011 17:08:06 +0000 Subject: [PATCH] (bug 27492) Fix regexes for matching JS regexes which could get messed up by the minifier in extreme circumstances --- 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 91d330b3e1..6ddaf8de3c 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]+(\\/[^\\/\\r\\n\\*][^\\/\\r\\n]*\\/g?i?)/', '$2' ); - $parser->add( '/[^\\w\\$\\/\'"*)\\?:]\\/[^\\/\\r\\n\\*][^\\/\\r\\n]*\\/g?i?/', '$1' ); + $parser->add( '/([ \\t]+(\\/(?=[^\\/\\r\\n\\*])[^\\/\\\\]*(\\\\.[^\\/\\\\]*)*\\/(i|g)*))/', '$1' ); + $parser->add( '/([^\\w\\$\\/\'"*)\\?:](\\/(?=[^\\/\\r\\n\\*])[^\\/\\\\]*(\\\\.[^\\/\\\\]*)*\\/(i|g)*))/', '$1' ); // Remove comments $parser->add( '/\\/\\*(.|[\\r\\n])*?\\*\\//' ); // Preserve the newline after a C++-style comment -- bug 27046 -- 2.20.1