|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-01-08 15:05 UTC] 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. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 02:00:01 2025 UTC |
Removing the lines between {* and *} surprisingly fixes the problem.