php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1561 str_replace not replacing when string @ end of string
Submitted: 1999-06-17 14:38 UTC Modified: 1999-06-18 11:49 UTC
From: sander at pilon dot com Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 3.0.7 OS: Linux
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sander at pilon dot com
New email:
PHP Version: OS:

 

 [1999-06-17 14:38 UTC] sander at pilon dot com
In a program ...

This works:
   $url = str_replace('$id',$id,$url." ");

But this doesnt: (It doesnt replace '$id' at all.)
  $url = str_replace('$id',$id,$url);

(It should work.)

$url is some string coming from a MySQL database, with '$id' in it (as text). This time at the end. If I assign the url manually it replaces fine, just not when it comes from a SQL datbase AND it's at the end of string. (So it's pretty hard to reproduce in just text.)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-06-18 11:49 UTC] sas at cvs dot php dot net
fixed in 3.0.8
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 10:00:02 2026 UTC