Hi, i recently upgraded from 4.0.4pl1 to 4.2.3 and noticed a different behavior with preg_replace when the substitution string is a variable containing backslashes. at this point 4.2.3 eats every second slash as 4.0.4pl1 don't .
here's my example: <? $TPL = "foosel#label#lesoof"; $DIFF= this one comes from database and contains everything between the quotes: "\\sth\\\foo\foobar\\\\3" $TPL = preg_replace("/\#([^\#]+)\#/",'<\\1> '.$DIFF.' </\\1>',$TPL); print $TPL; // returns "foosel<label> \\sth\\\foo\foobar\\\\3 </label>lesoof" as expected in 4.0.4pl1 // misleadingly returns "foosel<label> \sth\\foo\foobar\\3 </label>lesoof" in 4.2.3 ?> i found bug#12668 about this issue. but it is flagged "Analyzed" for over one year with the hint to use preg_replace_callback as workaround. imho the substitution string should be treated as is with the option to turn on addslashes, stripslashes or die($hard) as needed. hardly believable everybody is parsing potentially malicious content whereas addslashes would be useful. i try to parse sourcecode and this new feature is my personal pain in the ass as you certainly can imagine ;) is it possible to regain the old (expected) functionality maybe by an additional argument to preg_replace ??? thanks in advance Christian -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php