php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5718 Preg_Replace with e modifyer will return to much of the match
Submitted: 2000-07-21 10:25 UTC Modified: 2000-07-21 17:29 UTC
From: wico at cnh dot nl Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Latest CVS (21/07/2000) OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: wico at cnh dot nl
New email:
PHP Version: OS:

 

 [2000-07-21 10:25 UTC] wico at cnh dot nl
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)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-21 17:29 UTC] andrei at cvs dot php dot net
Fixed, although it wasn't preg_replace()'s fault.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 11:01:32 2025 UTC