#32985 [Opn]: /e Modifier Escaping Double Quotes With \ Even Though Magic Quotes Is Off

From: Date: Mon, 09 May 2005 14:02:51 +0000
Subject: #32985 [Opn]: /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-78809@lists.php.net to get a copy of this message
ID: 32985 User updated by: crypticcreeper at yahoo dot com Reported By: crypticcreeper at yahoo dot com Status: Open Bug Type: PCRE related Operating System: Linux & Windows PHP Version: 5.0.4 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#78809) next »