php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32985 /e Modifier Escaping Double Quotes With \ Even Though Magic Quotes Is Off
Submitted: 2005-05-09 15:32 UTC Modified: 2005-05-10 00:55 UTC
From: crypticcreeper at yahoo dot com Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 5.0.4 OS: Linux & Windows
Private report: No CVE-ID: None
 [2005-05-09 15:32 UTC] crypticcreeper at yahoo dot com
Description:
------------
When using the /e modifier if the match contains a double quote it is escaped with a \

If it was magic quotes I am assuming it would effect single quotes too, but in fact doesnt. I tested this on Windows 2000 5.0.5-dev and on Linux 5.0.4 and both had same results. Even when I test using a conditional to see if magic quotes is on it still runs it. I even manually set magic quotes off in the script and still the problem occurred. I'm not sure if this is documented behavior, I do know /e causes PHP to escape data, but why only double quotes?

Reproduce code:
---------------
$data = ' " '
$data = preg_replace('/(")/ie', "'$1'", $data);
echo $data;

Expected result:
----------------
"

Actual result:
--------------
\"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-05-09 16:02 UTC] crypticcreeper at yahoo dot com
Unfortunately I can't even use stripslashes() in the replace paramter because it will not work correctly because backslashs are not escaped so legitimate ones will be stripped. I ended up doing a str_replace for \" as a temporary fix until this gets resolved.
 [2005-05-10 00:55 UTC] sniper@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 22:01:30 2024 UTC