#40846 [Opn]: pcre.backtrack_limit too restrictive

From: Date: Sat, 17 Mar 2007 19:26:36 +0000
Subject: #40846 [Opn]: pcre.backtrack_limit too restrictive
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110469@lists.php.net to get a copy of this message
ID: 40846 Updated by: tony2001@php.net Reported By: crisp at xs4all dot nl Status: Open -Bug Type: PHP options/info functions +Bug Type: Feature/Change Request Operating System: all PHP Version: 5.2.1 New Comment: >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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#110469) next »