#25632 [NEW]: str_replace incorrect
| From: | info at comsen dot de | Date: | Tue, 23 Sep 2003 11:01:27 +0000 |
| Subject: | #25632 [NEW]: str_replace incorrect | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-47981@lists.php.net to get a copy of this message | ||
From: info at comsen dot de
Operating system: Apache httpd 1.3.26
PHP version: 4.3.1
PHP Bug Type: Strings related
Bug description: str_replace incorrect
Description:
------------
I have a text with placeholders for images: ##-1 -> img No 1 ##-2 img No 2
etc.
It works fine with the reproduce code as long as the number is a single
digit:
with numbers higher then 9 the image will be shown followed by the last
digit.
Is it a bug?
Reproduce code:
---------------
$text "abc def ##-23 yxz";
$pic = "<img src = 'img-23'>";
$text_new = str_replace(*##-'.$pic, $image, $text);
Expected result:
----------------
(image shown)
Actual result:
--------------
(image shown)3
--
Edit bug report at http://bugs.php.net/?id=25632&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25632&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25632&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25632&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25632&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25632&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25632&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25632&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25632&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25632&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25632&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25632&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25632&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25632&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25632&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25632&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25632&r=float