|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #44538 str_replace does not work for some regular expressions
Submitted: 2008-03-26 16:29 UTC Modified: 2008-04-03 01:00 UTC
From: andre dot thompson at sta dot uwi dot edu Assigned:
Status: No Feedback Package: Strings related
PHP Version: 5.2.5 OS: Windows 2003 Server Standard
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
43 - 9 = ?
Subscribe to this entry?

 [2008-03-26 16:29 UTC] andre dot thompson at sta dot uwi dot edu
str_replace does not replace with more than one space.

Reproduce code:
$repstr = "', W";
$astring = "UPDATE Assets SET Supplier = '6', WHERE AssetID = '112'";
$update1 = str_replace($repstr, "'    W", $astring);
echo $update1;

Expected result:
UPDATE Assets SET Supplier = '6'    WHERE AssetID = '112'

Actual result:
UPDATE Assets SET Supplier = '6' WHERE AssetID = '112'


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-26 16:50 UTC]
Please try using this CVS snapshot:
For Windows (zip):

For Windows (installer):

Works fine to me on 5.2.6.
 [2008-03-26 16:52 UTC]
Web browser flatten multiple spaces down to one. If you run this via the command line it would show correctly.
 [2008-04-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 18 17:01:29 2024 UTC