From: Operating system: Ubuntu 10.10 PHP version: 5.3.5 Package: Scripting Engine problem Bug Type: Bug Bug description:incorrect result preg_replace with large strings
Description: ------------ While converting phpBB code to html, preg_replace return empty string. Test case: <?php $str = '[b]'; // Please try run this test case also with $i<99997 and compare result's for ($i=0; $i<99998; $i++) $str .= 'q'; $str = preg_replace("#\[b\](.+?)\[\/b\]#is", "[p]", $str); echo $str; ?> I know about pcre.backtrack_limit, but i think in this case PCRE must generate exception with fatal error. Test script: --------------- <?php $str = '[b]'; // Please try run this test case also with $i<99997 and compare result's for ($i=0; $i<99998; $i++) $str .= 'q'; $str = preg_replace("#\[b\](.+?)\[\/b\]#is", "[p]", $str); echo $str; ?> Expected result: ---------------- Return non empty string or generate exception with fatal error Actual result: -------------- Empty string -- Edit bug report at http://bugs.php.net/bug.php?id=53825&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53825&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53825&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53825&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=53825&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53825&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=53825&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=53825&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=53825&r=needscript Try newer version: http://bugs.php.net/fix.php?id=53825&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=53825&r=support Expected behavior: http://bugs.php.net/fix.php?id=53825&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=53825&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=53825&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=53825&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53825&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=53825&r=dst IIS Stability: http://bugs.php.net/fix.php?id=53825&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=53825&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=53825&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=53825&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=53825&r=mysqlcfg