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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 15:01:31 2024 UTC