ID: 40846
User updated by: crisp at xs4all dot nl
Reported By: crisp at xs4all dot nl
Status: Open
Bug Type: Feature/Change Request
Operating System: all
PHP Version: 5.2.1
New Comment:
>Changing the limit doesn't mean removing the limit.
But if you change the default limits to match the defaults limits set
in PCRE internally you won't affect it's behavior compared to previous
versions of PHP where the internal settings in PCRE were not
overridden.
Either that or don't override PCRE's internal settings unless these
directives are explicitly set and enabled in php.ini (at the moment
these directives are commented in the php.ini samples).
Previous Comments:
------------------------------------------------------------------------
[2007-03-17 19:26:36] [EMAIL PROTECTED]
>that way there won't be a compatibility problem with previous
>versions of PHP as we have now.
Changing the limit doesn't mean removing the limit.
------------------------------------------------------------------------
[2007-03-17 19:19:57] crisp at xs4all dot nl
Description:
------------
The new pcre.backtrack_limit configuration directive is by default too
restrictive (100.000) which results in failure of many - often quite
simple - regular expressions.
I take it that this directive overrules the default setting for
MATCH_LIMIT in PCRE which will also imply that the naming of this
directive is wrong since MATCH_LIMIT is for every match() call in PCRE,
not only those for backtracking.
It would make more sense to change the default of both
pcre.backtrack_limit and pcre.recursion_limit to the ones that PCRE
itself also supplies (10.000.000 for both) - that way there won't be a
compatibility problem with previous versions of PHP as we have now.
Reproduce code:
---------------
$a = 'baab' . str_repeat('a', 100024);
$b = preg_replace('/b.*b/', '', $a);
Expected result:
----------------
I would expect $b to contain 100024 times 'a'
Actual result:
--------------
$b is a nullpointer, preg_last_error() reports '2' which is
PREG_BACKTRACK_LIMIT_ERROR
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=40846&edit=1