ID: 43788 Updated by: [EMAIL PROTECTED] Reported By: david at dfoerster dot de -Status: Open +Status: Bogus Bug Type: PCRE related Operating System: Linux PHP Version: 5.2.5 New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php preg_last_error() returns 2 (= PREG_BACKTRACK_LIMIT_ERROR). I.e. backtrack limit was exhausted. See http://pcre.org/man.txt for explanation about backtracking. Previous Comments: ------------------------------------------------------------------------ [2008-01-08 15:09:40] david at dfoerster dot de Removing the lines between {* and *} surprisingly fixes the problem. ------------------------------------------------------------------------ [2008-01-08 15:05:12] david at dfoerster dot de Description: ------------ The preg_replace function returns null when a certain string is passed as haystack. Removing some lines from the string fixes the issue. The search pattern is not even found in the problematic string. This problem occurs with all PHP 5 versions I tested (5.2.0, 5.2.4, 5.2.5). It does not occur with PHP 4. (The search pattern uses back-references in case that matters.) Reproduce code: --------------- Run this script: http://dfoerster.de/misc/preg_replace_bug It prints the string length before and after the matching. With PHP 5 the length after the matching is 0, with PHP 4 it's the same as before as no replacement takes places. Expected result: ---------------- strlen returns the same length as before the matching. Actual result: -------------- strlen returns 0 after matching. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43788&edit=1
