Edit report at http://bugs.php.net/bug.php?id=51963&edit=1
ID: 51963 Updated by: fel...@php.net Reported by: lexx918 at mail dot ru Summary: preg_replace returns NULL, if in line more than 991 blanks -Status: Open +Status: Bogus Type: Bug Package: PCRE related Operating System: Windows XP SP3 PHP Version: 5.2.13 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Checking the value of preg_last_error() after the fail will revelate you that there was a backtrack limit error. Which can be fixed by setting a new value for pcre.backtrack_limit directive. (the default is 100000) http://docs.php.net/manual/en/pcre.configuration.php Previous Comments: ------------------------------------------------------------------------ [2010-06-01 10:58:43] lexx918 at mail dot ru Description: ------------ One of my regular expressions leads to return of emptiness to functions preg_replace if the initial line contains more than 991 blanks. Example more low. The first line works, the second dies also I lose all contents. Test script: --------------- $text = 'test'.str_repeat(' ', 991).'test'; // work $text = 'test'.str_repeat(' ', 992).'test'; // empty :( if ($text = preg_replace('/(.*?\s+)"([^\s]+.*?)/', '$1<quot1>$2', $text)) { echo "GOOD\n"; } else { echo "BAD\n"; } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=51963&edit=1