#32985 [Opn->Bgs]: /e Modifier Escaping Double Quotes With \ Even Though Magic Quotes Is Off
| From: | sniper@php.net | Date: | Mon, 09 May 2005 22:55:50 +0000 |
| Subject: | #32985 [Opn->Bgs]: /e Modifier Escaping Double Quotes With \ Even Though Magic Quotes Is Off | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-78830@lists.php.net to get a copy of this message | ||
ID: 32985
Updated by: sniper@php.net
Reported By: crypticcreeper at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: PCRE related
Operating System: Linux & Windows
PHP Version: 5.0.4
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2005-05-09 16:02:48] 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-09 15:32:00] 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:
--------------
\"
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32985&edit=1