PHP 4.0 Bug #10111: e modifier alters string extraction in preg_replace
| From: | gcousin at startem dot net | Date: | Mon, 02 Apr 2001 12:08:30 +0000 |
| Subject: | PHP 4.0 Bug #10111: e modifier alters string extraction in preg_replace | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-50570@lists.php.net to get a copy of this message | ||
From: gcousin@startem.net
Operating system: Linux Debian
PHP version: 4.0.4pl1
PHP Bug Type: *Regular Expressions
Bug description: e modifier alters string extraction in preg_replace
A short example :
$newsitem = preg_replace('/(<([a-zA-Z-]+)
([^>]*)analyze="[0-9]*"([^>]*)>)(.*?)(<\/\\2>)/mse',
"'\\1'.transformNewsitemPart('\\5').'\\6'", $newsitem);
where I transform the text between any html tag with "analyze" attribute.
The problem is that the preg_replace function with e modifier adds backslashes before any " in
the matched text (\\5) BEFORE the function transformNewsitemPart is interpreted.
The behaviour is new in php 4.0.4. It was not present in php 4.0.3.
--
Edit Bug report at: http://bugs.php.net/?id=10111&edit=1