php.net |  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:
MUST BE VALID
Solve the problem:
45 - 22 = ?
Subscribe to this entry?

 
 [2008-03-26 16:29 UTC] andre dot thompson at sta dot uwi dot edu
Description:
------------
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'


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-03-26 16:50 UTC] felipe@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows (zip):
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi

Works fine to me on 5.2.6.
 [2008-03-26 16:52 UTC] scottmac@php.net
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 Mar 28 11:01:27 2024 UTC