|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15050 preg_replace backslashes " or ' character
Submitted: 2002-01-15 10:07 UTC Modified: 2002-01-15 10:59 UTC
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: joyeux at 1984 dot cz Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 4.1.0 OS: MDK Linux
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 !
Your email address:
Solve the problem:
42 + 39 = ?
Subscribe to this entry?

 [2002-01-15 10:07 UTC] joyeux at 1984 dot cz

$text=' something and one " ';



something and one "
something and one \"

- in executable mode preg_replace adds a backslash. Why?
I think it shouldn't do anything with.

- it's the same when I use ' instead ", but switched.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-15 10:59 UTC]
Not a bug. RTM on Magic Quotes.
 [2004-03-31 11:32 UTC] php at derailer dot org
This still occurs for me, but only with double quotes. I turned off every magic_quotes_* directive in php.ini just to be sure, and it still happens, just as described here. Single quotes, and literal backslashes *are not affected* for me at all.

PHP 4.3.5, BTW.
 [2004-08-02 21:22 UTC] abodeman at yahoo dot com
This is NOT a bogus bug. Sander, it is NOT due to that awful PHP kludge called Magic Quotes. Magic Quotes puts backslashes into data received through $_GET, $_POST, or $_COOKIE. None of those are being used here.

Due to this bug, I am going to have to write my own character-by-character string replacer, or fire up Perl in the background with backticks. I hate PHP.
 [2004-08-02 21:23 UTC] jhelzer at cse dot unl dot edu
This is hardy bogus.  GPC isn't even involved, just look at the code sample.

This bug is ludicrous.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Wed Jan 26 23:03:47 2022 UTC