|  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
 [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


Add a Patch

Pull Requests

Add a Pull Request


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

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

 [1999-10-28 12:42 UTC] andrei at cvs dot php dot net
This has been fixed in CVS.
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-2023 The PHP Group
All rights reserved.
Last updated: Thu Nov 30 12:01:25 2023 UTC