php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2623 Escaping a backslash doesn't seem to work in preg_replace
Submitted: 1999-10-27 13:02 UTC Modified: 1999-10-28 12:42 UTC
From: rob dot duarte at fmr dot com Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0.12 OS: Solaris 2.5.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rob dot duarte at fmr dot com
New email:
PHP Version: OS:

 

 [1999-10-27 13:02 UTC] rob dot duarte at fmr dot com
$url = preg_replace( "/\\/", "/", $var);

This returns...

Warning: No ending delimiter found in /usr/local/apache/htdocs/projects/documentation.php3 on line 18


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-10-27 13:10 UTC] rob dot duarte at fmr dot com
Workaround:

$url = preg_replace( "/\\134/", "/", $var);


 [1999-10-28 12:42 UTC] andrei at cvs dot php dot net
This has been fixed in CVS.
Note:
Since PHP does its own backslashing in strings, in order for your
pattern to work properly it would need to look like:
"/\\\\/"

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