#40846 [NEW]: pcre.backtrack_limit too restrictive
From: crisp at xs4all dot nl
Operating system: all
PHP version: 5.2.1
PHP Bug Type: PHP options/info functions
Bug description: pcre.backtrack_limit too restrictive
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 bug report at http://bugs.php.net/?id=40846&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40846&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40846&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40846&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40846&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=40846&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40846&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40846&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40846&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40846&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40846&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=40846&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=40846&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40846&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40846&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40846&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40846&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40846&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40846&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40846&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40846&r=mysqlcfg
Thread (14 messages)
- crisp at xs4all dot nl
- tony2001@php.net#40846 [Opn]: pcre.backtrack_limit too restrictive
- crisp at xs4all dot nl#40846 [Opn]: pcre.backtrack_limit too restrictive
- tigr at mail15 dot com#40846 [Com]: pcre.backtrack_limit too restrictive
- tigr at mail15 dot com#40846 [Com]: pcre.backtrack_limit too restrictive
- nlopess@php.net#40846 [Opn]: pcre.backtrack_limit too restrictive
- tigr at mail15 dot com#40846 [Com]: pcre.backtrack_limit too restrictive
- crisp at xs4all dot nl#40846 [Opn]: pcre.backtrack_limit too restrictive
- brandon at invisionpower dot com#40846 [Com]: pcre.backtrack_limit too restrictive
- drnick at physics dot byu dot edu#40846 [Com]: pcre.backtrack_limit too restrictive
- daan at react dot nl#40846 [Com]: pcre.backtrack_limit too restrictive
- tom at r dot je#40846 [Com]: pcre.backtrack_limit too restrictive
- wclark at xoom dot orgReq #40846 [Com]: pcre.backtrack_limit too restrictive
- felipe@php.netReq #40846 [Opn->Csd]: pcre.backtrack_limit too restrictive