|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-07-12 16:06 UTC] felipe@php.net
[2010-06-25 14:02 UTC] daniel dot reiche at tu-dresden dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 18:00:02 2025 UTC |
Description: ------------ if the $subject parameter's length exceeds 100009, str_replace has no return value. This has been reproduced on windows 2003 with php 5.2.6 and Linux with php 5.2.5 PS: If there is backslash in the $subject parameter and $pattern parameter, the critical poiont will change, the maximum string length to reproduce this bug will increase. Reproduce code: --------------- <? $dummyText=str_pad("[start]",100016-strlen("[start][end]"),"*")."[end]"; str_replace_test($dummyText); $dummyText=str_pad("[start]",100017-strlen("[start][end]"),"*")."[end]"; str_replace_test($dummyText); function str_replace_test($dummyText){ $result=preg_replace("/\[start\](.+?)\[end\]/eis","passed",$dummyText); $result==""?$result="failed":true; echo "str_replace with length: ".strlen($dummyText)." ".$result."<br>"; } ?> Expected result: ---------------- str_replace with length: 100009 passed str_replace with length: 100010 passed Actual result: -------------- str_replace with length: 100009 passed str_replace with length: 100010 failed