php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25632 str_replace incorrect
Submitted: 2003-09-23 07:01 UTC Modified: 2003-09-23 07:35 UTC
From: info at comsen dot de Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.3.1 OS: Apache httpd 1.3.26
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: info at comsen dot de
New email:
PHP Version: OS:

 

 [2003-09-23 07:01 UTC] info at comsen dot de
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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-23 07:35 UTC] sniper@php.net
1. Too old PHP version (we're at 4.3.3 already)
2. Your example script has 2 parse errors for starters..plus you propably want to use preg_replace() anyway.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 06:01:30 2024 UTC