From: paul at pscs dot co dot uk Operating system: Win32 (Windows XP) PHP version: 4.3.5RC3 PHP Bug Type: Reproducible crash Bug description: preg_replace regexp causes PHP to die
Description: ------------ It looks as if when PHP is doing preg_replace and there are a lot of () values, then it just dies With my example code, it'll die when doing preg_replace I've tried a few values of $regexp on line 2 /<(.|\n)*>/ - it dies /<(.)*>/ - it dies /<.*>/ - it works fine If the $test string is 1844 characters long it works fine, if it's 1845 characters long it dies. It doesn't matter whether the string actually matches or not, it's the number of characters it's trying to match. The problem doesn't seem to happen with preg_match Reproduce code: --------------- <?php $regexp = "/<(.|\n)*>/"; $stringlength = 1845; echo "test start \n"; $test = '<' . str_repeat('x', $stringlength - 1); $test = preg_replace($regexp,"",$test); echo "test done\n"; ?> Expected result: ---------------- test start test done Actual result: -------------- <nothing> -- Edit bug report at http://bugs.php.net/?id=27310&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27310&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27310&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=27310&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=27310&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=27310&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=27310&r=needscript Try newer version: http://bugs.php.net/fix.php?id=27310&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=27310&r=support Expected behavior: http://bugs.php.net/fix.php?id=27310&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=27310&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=27310&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=27310&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27310&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=27310&r=dst IIS Stability: http://bugs.php.net/fix.php?id=27310&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=27310&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=27310&r=float