Edit report at http://bugs.php.net/bug.php?id=54614&edit=1

 ID:                 54614
 Updated by:         ras...@php.net
 Reported by:        php at richardneill dot org
 Summary:            Trivial RE failure:  /([^b]*a*)*$/
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            *Regular Expressions
 Operating System:   Linux
 PHP Version:        5.3.6
 Block user comment: N
 Private report:     N

 New Comment:

With pcre.backtrack_limit = 1000000 this works fine for me on 5.3.6. Are
you sure 

you increased the limit in the right place?


Previous Comments:
------------------------------------------------------------------------
[2011-04-27 21:15:34] php at richardneill dot org

A slightly simpler test case is:

  $contents =  "aaaaaaaab";

  $search = '/(a*a*)*$/';

------------------------------------------------------------------------
[2011-04-27 18:43:02] php at richardneill dot org

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 this bug report at http://bugs.php.net/bug.php?id=54614&edit=1

Reply via email to