Bug #15552 Updated: str_replace with semicolons finds other characters as well

From: Date: Thu, 14 Feb 2002 14:54:41 +0000
Subject: Bug #15552 Updated: str_replace with semicolons finds other characters as well
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-312@lists.php.net to get a copy of this message
ID: 15552 Updated by: edink@php.net Reported By: hallvors@online.no -Status: Open +Status: Bogus Bug Type: Strings related Operating System: SunOS no14 / Linux merlin 2.4.2 PHP Version: 4.0.6 New Comment: I cannot reproduce this. I tried to following code snippet: $f=file("http://www.excelsior.cc/js/dqm_script.js"); $f=implode("", $f); print str_replace(";", ";\n", $f); Works as expected. The problem is not in str_replace. Previous Comments: ------------------------------------------------------------------------ [2002-02-14 09:15:10] hallvors@online.no if(isset($wrapme)){ $thescript=str_replace(";", ";\n", $thescript); } This is my solution when trying to wade through horribly compact "all-on-one-line" style JavaScript: $thescript is read from the JS-URL with fopen() and I'm trying to wrap it on semicolons. Result: var q22="";var q23=""; becomes var q22=" " ; var q23=" " ; (evident on http://www.hallvord.com/opera/sitetest.php?urlurl=http%3A%2F%2Fwww.excelsior.cc%2Fjs%2Fdqm_script.js&wrapme=Wrap+this+script%21&startscr=0&endscr=2265 ) Have I misunderstood something here or is it a bug that str_replace with ';' as search also finds "" ? Tried preg_replace with the same result, even when given a \x hex code input. Reproduced on two different versions of PHP (most recent being 4.0.6 but I'm not in charge of upgrading the servers so I can't test it in later builds) and two different server setups. I hope this is a genuine bug - if not I'm sorry! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=15552&edit=1

« previous php.bugs (#312) next »