PHP 4.0 Bug #5718: Preg_Replace with e modifyer will return to much of the match
| From: | wico at cnh dot nl | Date: | Fri, 21 Jul 2000 08:25:46 +0000 |
| Subject: | PHP 4.0 Bug #5718: Preg_Replace with e modifyer will return to much of the match | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-25324@lists.php.net to get a copy of this message | ||
From: wico@cnh.nl
Operating system: linux
PHP version: 4.0 Latest CVS (21/07/2000)
PHP Bug Type: Scripting Engine problem
Bug description: Preg_Replace with e modifyer will return to much of the match
Test:
<?
$data = "try <'to' match \"this\"> in php";
preg_match_all("'<([^>]+)>'im", $data, $match);
var_dump($match);
echo preg_replace("'<([^>]+)>'ime",
"Wico('\\1');", $data);
function Wico ($plop) {
die("plop: ($plop)");
return($plop . $plop);
}
?>
output:
array(2) {
[0]=>
array(1) {
[0]=>
string(19) "<'to' match "this">"
}
[1]=>
array(1) {
[0]=>
string(17) "'to' match "this""
}
}
plop: ('to' match \"this\"> in php)