From: Operating system: Linux PHP version: 5.3.6 Package: *Regular Expressions Bug Type: Bug Bug description:Trivial RE failure: /([^b]*a*)*$/
Description: ------------ If I search in the string : 'aaaaaaaab' with the RE: '/([^b]*a*)*$/' then preg_replace fails with a backtrack-limit error. (error 2) I have backtrack.limit configured to 32MB, so something is very wrong. The example fails on several different PHP versions, CPU architectures and Linux Distros. However, using Perl for the same RE works fine. Test script: --------------- $contents = "aaaaaaaab"; $search = '/([^b]*a*)*$/'; $result = preg_replace($search,"x",$contents); if ($result === NULL){ echo "preg failed, error is ".preg_last_error()."\n"; }else{ echo "success\n"; } Expected result: ---------------- preg_replace shouldn't fail. Actual result: -------------- preg_replace returns NULL, and preg_last_error returns 2. -- Edit bug report at http://bugs.php.net/bug.php?id=54614&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54614&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54614&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54614&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54614&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54614&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54614&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54614&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54614&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54614&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54614&r=support Expected behavior: http://bugs.php.net/fix.php?id=54614&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54614&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54614&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54614&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54614&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54614&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54614&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54614&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54614&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54614&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54614&r=mysqlcfg