php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41436 e modifier doesn't go with str_replace
Submitted: 2007-05-18 15:57 UTC Modified: 2007-05-26 01:00 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: nino at recgr dot com Assigned:
Status: No Feedback Package: PCRE related
PHP Version: 5.2.2 OS: Windows XP SP2
Private report: No CVE-ID: None
 [2007-05-18 15:57 UTC] nino at recgr dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-18 16:07 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2007-05-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC