ID: 36049 User updated by: Jared dot Williams1 at ntlworld dot com Reported By: Jared dot Williams1 at ntlworld dot com -Status: Open +Status: Bogus Bug Type: Strings related Operating System: Win2000 PHP Version: 5.1.2 New Comment:
Err, my mistake Previous Comments: ------------------------------------------------------------------------ [2006-01-17 13:38:57] Jared dot Williams1 at ntlworld dot com Description: ------------ str_replace() not replacing entire search string with its replacement. Reproduce code: --------------- <?php $s = array ( 0 => '%host', 1 => '%login', 2 => '%user', 3 => '%time', 4 => '%method', 5 => '%url', 6 => '%protocol', 7 => '%status', 8 => '%bytesSent', 9 => '%referrer', 10 => '%userAgent', ); $r = array ( 0 => '([^ ])+', 1 => '([^ ])+', 2 => '([^ ])+', 3 => '([^\\]])+', 4 => '([^ ])+', 5 => '([^ ])+', 6 => '([^"])+', 7 => '([^ ])+', 8 => '([^ ])+', 9 => '([^"])+', 10 => '([^"])+', ); $subject = '%host %login %user [%time] "%method %url %protocol" %status %bytesSent "%referrer" "%userAgent"'; echo str_replace($s, $r, $subject), "\n"; Expected result: ---------------- ([^ ])+ ([^ ])+ ([^ ])+ [([^\]])+] "([^ ])+ ([^ ])+ ([^"])+" ([^ ])+ ([^ ])+ "([^"])+" "([^ ])+" Actual result: -------------- ([^ ])+ ([^ ])+ ([^ ])+ [([^\]])+] "([^ ])+ ([^ ])+ ([^"])+" ([^ ])+ ([^ ])+ "([^"])+" "([^ ])+Agent" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=36049&edit=1
