#50570 [NEW]: str_replace doesn't work with URL replacement
| From: | julijan dot andjelic at gmail dot com | Date: | Thu, 24 Dec 2009 15:57:02 +0000 |
| Subject: | #50570 [NEW]: str_replace doesn't work with URL replacement | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-146090@lists.php.net to get a copy of this message | ||
From: julijan dot andjelic at gmail dot com
Operating system: Linux Mint 7 (2.6.28-17-generic)
PHP version: 5.3.1
PHP Bug Type: Streams related
Bug description: str_replace doesn't work with URL replacement
Description:
------------
When using str_replace with 2 arrays and 1 of them contains URL-s the
result gets messed up. I provided a code snippet which shows it.
Reproduce code:
---------------
<?php
$str='I love a b c';
$array0=array('a','b','c');
$array1=array('http://www.example.com/1.html','http://www.example.com/2.html','http://www.example.com/3.html');
echo str_replace($array0, $array1, $str);
?>
Expected result:
----------------
I love http://www.example.com/1.html
http://www.example.com/2.html
http://www.example.com/3.html
Actual result:
--------------
I love http://www.example.http://www.example.com/3.htmlom/1.html
http://www.example.http://www.example.com/3.htmlom/2.html
http://www.example.com/3.html
--
Edit bug report at http://bugs.php.net/?id=50570&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50570&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50570&r=trysnapshot53
Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50570&r=trysnapshot60
Fixed in SVN: http://bugs.php.net/fix.php?id=50570&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50570&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=50570&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=50570&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=50570&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=50570&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=50570&r=support
Expected behavior: http://bugs.php.net/fix.php?id=50570&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=50570&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=50570&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=50570&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50570&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=50570&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=50570&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=50570&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=50570&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=50570&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=50570&r=mysqlcfg