From: nino at recgr dot com Operating system: Windows XP SP2 PHP version: 5.2.2 PHP Bug Type: PCRE related Bug description: e modifier doesn't go with str_replace
Description: ------------ When I use preg_replace() with e modifier along with str_replace in the replace string, it doesn't work well. Reproduce code: --------------- HTML code ($s): <ul style="list-style-type: square;"> <li>Megadeth -- Back to the Start, Peace Sells, Rust In Peace, Countdown to Extinction </li><li>Ramones -- Anthology, Ramonesmania, Rocket to Russia, Too Tough To Die, Adios Amigos </li> </ul> $de = array('<li>', '</li>'); $s = preg_replace("#\<ul style\="list-style-type\: square;"\>(.+?)\</ul\>#sie", "'<ul style="list-style-type: square;">'.str_replace(\"$de\", '', '$1').'</ul>'", $s); Expected result: ---------------- I expect that all <li> and </li> get removed in the HTML part ($s). HOWEVER, when I turn $de to a string, so it contains <li> *or* </li>, then it works. Actual result: -------------- <li> and </li> tags don't get removed. This is also explained here (if it helps): http://forum-grounds.com/viewtopic.php?p=756 -- Edit bug report at http://bugs.php.net/?id=41436&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=41436&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=41436&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=41436&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=41436&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=41436&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=41436&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=41436&r=needscript Try newer version: http://bugs.php.net/fix.php?id=41436&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=41436&r=support Expected behavior: http://bugs.php.net/fix.php?id=41436&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=41436&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=41436&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=41436&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41436&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=41436&r=dst IIS Stability: http://bugs.php.net/fix.php?id=41436&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=41436&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=41436&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=41436&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=41436&r=mysqlcfg