On 01/29/2011 04:06 AM, Aaron Schulz wrote:
In JavaScriptDistiller, inside of the createParser() function, we have: $parser->add( '/\/\*(.|[\r\n])*?\*\//' );
It took me hours to track down that this was causing Apache 2.1.11 to crash on nearly any page view on my test wiki. This happened when a large JS bundle is loaded, such as: load.php?debug=false&lang=en&modules=jquery.checkboxShiftClick|jquery.client|jquery.cookie|jquery.makeCollapsible|jquery.placeholder|mediawiki.action.watch.ajax|mediawiki.language|mediawiki.legacy.ajax|mediawiki.legacy.diff|mediawiki.legacy.mwsuggest|mediawiki.legacy.wikibits|mediawiki.util&skin=vector&version=20110129T005517Z
I made a simple php file to reproduce this. It crashes when viewed over apache but not CLI. It appears to be http://bugs.php.net/bug.php?id=47689 (which uses a similar regex).
Is something worth adding a note somewhere about or tweaking some code?
Hmm... I don't really know what's going on inside PHP's PCRE implementation, but you might want to try replacing that regexp with:
$parser->add( '/\/\*.*?\*\//s' );