ID:               43788
 User updated by:  david at dfoerster dot de
 Reported By:      david at dfoerster dot de
 Status:           Open
 Bug Type:         PCRE related
 Operating System: Linux
 PHP Version:      5.2.5
 New Comment:

Removing the lines between {* and *} surprisingly fixes the problem.


Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to