ID: 39695 Updated by: [EMAIL PROTECTED] Reported By: ivo_gelov at abv dot bg Status: Bogus Bug Type: PCRE related Operating System: Linux Fedora Core 4 PHP Version: 5.2.0 New Comment:
AFAIK both maximum for recursion and match limits is set to 10000000. Previous Comments: ------------------------------------------------------------------------ [2006-11-30 18:58:13] ivo_gelov at abv dot bg But what is the limit for this setting ? ------------------------------------------------------------------------ [2006-11-30 18:17:37] [EMAIL PROTECTED] Just increase pcre.backtrack_limit. ------------------------------------------------------------------------ [2006-11-30 18:05:44] ivo_gelov at abv dot bg I checked "$2$1" instead of "\$2\$1" and it worked. So this is my fault since I was looking an example in an old manual, not the current one. Sorry for disturbing. But there is another issue - when I used preg_replace in PHP 5.1.4 with a relatively long string as a subject, it worked without problems. But after upgrade to 5.2.0, it now gives me an error PREG_BACKTRACK_LIMIT_ERROR with default value for "pcre.backtrack_limit" (not listed in PHP.INI at all). What can I do ? Should I revert back to 5.1.4 ? Or just compile 5.2.0 with the 6.6 version of PCRE library ? ------------------------------------------------------------------------ [2006-11-30 17:36:52] [EMAIL PROTECTED] Not reproducible. Btw, this code - $rep = '\$2\$1'; apparently won't work. ------------------------------------------------------------------------ [2006-11-30 16:55:02] ivo_gelov at abv dot bg Description: ------------ There are 2 strange effects/bugs, may be one depends on the other, I do not know. 1. PREG_REPLACE does not recognize $n as a back reference in its second argument. It will recognize only \\n references. 2. PREG_REPLACE returns NULL if no match is found, instead of returning unmodified subject This symptom is present only in 5.2.0 - there are no problems with 5.1.0 Reproduce code: --------------- $pat = '/^([a-zA-Z])(\d*)$/'; $rep = '\$2\$1'; $b = preg_replace($pat,$rep,'D764209812'); Expected result: ---------------- $b should be '764209812D' Actual result: -------------- $b is NULL ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39695&edit=1
