|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-05-20 11:32 UTC] sebastianvasile at yahoo dot com
Description: ------------ str_ireplace is causing a "Page cannot be displayed" when I pass a single letter as $search. Reproduce code: --------------- $value = str_ireplace($keyword, "<font color=\"red\">".strtoupper($keyword)."</font>", $value); I want to use this code for highlighting $keyword found in $value. $value is a large string. It works fine if $keyword has more than one caracter. It works fine if I use str_replace. If I pass only one character I get a Page cannot be displayed Expected result: ---------------- String with characters replaced. Actual result: -------------- The page cannot be displayed, in IE 6.0.2800.1106, on Win Me PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 05:00:02 2025 UTC |
I think I found what crashes it: I have: str_ireplace("t", "ttttt", "This is a text"); I get: crash. ************************************************ I have: str_ireplace("t", "tttt", "This is a text"); I get: tttthis is a ttttext (final t not replaced) *********************************************** I have: str_ireplace("Z", "zzzzzz", "zThis is a text"); I get: zzzzzzThis is a One more "z" in replacement will crash. ********************************************* Seems like the original string size is not increased.