Page 1 of 1

preg /e weirdness - PHP bug?

Posted: Tue Aug 08, 2006 10:19 pm
by GameMusic
preg_replace adds backslashes to quotes in backreferences when you use the /e modifier.

http://www.php.net/manual/en/function.p ... .php#39713

Most people use stripslashes, but this does not work because it also takes out backslashes that are supposed to be there. This post suggests unquoting \", but what other characters are being quoted? Do you have to unquote NULL or non-ASCii characters?

Posted: Tue Aug 08, 2006 10:22 pm
by feyd
Do not use the "e" modifier. Use preg_replace_callback() instead.