preg /e weirdness - PHP bug?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
GameMusic
Forum Newbie
Posts: 24
Joined: Fri Oct 28, 2005 8:33 pm

preg /e weirdness - PHP bug?

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Do not use the "e" modifier. Use preg_replace_callback() instead.
Post Reply