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

From: Date: Thu, 14 Feb 2002 14:15:12 +0000
Subject: Bug #15552: str_replace with semicolons finds other characters as well
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-309@lists.php.net to get a copy of this message
From: hallvors@online.no Operating system: SunOS no14 / Linux merlin 2.4.2 PHP version: 4.0.6 PHP Bug Type: Strings related Bug description: str_replace with semicolons finds other characters as well 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 bug report at http://bugs.php.net/?id=15552&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=15552&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=15552&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=15552&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=15552&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=15552&r=support Expected behavior: http://bugs.php.net/fix.php?id=15552&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=15552&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=15552&r=submittedtwice

« previous php.bugs (#309) next »