|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2011-04-27 21:15 UTC] php at richardneill dot org
[2011-04-27 21:54 UTC] rasmus@php.net
-Status: Open
+Status: Feedback
[2011-04-27 21:54 UTC] rasmus@php.net
[2011-04-27 23:47 UTC] php at richardneill dot org
-Status: Feedback
+Status: Open
[2011-04-27 23:47 UTC] php at richardneill dot org
[2011-05-21 21:35 UTC] felipe@php.net
-Package: *Regular Expressions
+Package: PCRE related
[2011-05-21 21:35 UTC] felipe@php.net
[2011-05-21 21:49 UTC] rasmus@php.net
-Status: Open
+Status: Closed
-Assigned To:
+Assigned To: rasmus
[2011-05-21 21:49 UTC] rasmus@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 02:00:01 2025 UTC |
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.