|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21645 eregi_replace seems not to work correctly
Submitted: 2003-01-14 21:34 UTC Modified: 2003-01-15 05:23 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: thelucas at directbox dot com Assigned:
Status: Closed Package: *Regular Expressions
PHP Version: 4.2.0 OS: 2.4.17-rc2aa2-2g
Private report: No CVE-ID: None
 [2003-01-14 21:34 UTC] thelucas at directbox dot com

eregi_replace does not seem to work correctly for me (php/4.2.0) 

var $_tpl_vars= array(); 
var $tpl; 
function render() 
foreach ($this->_tpl_vars as $key => $val) 
echo "$key - $t\n"; 
$rend_tpl = eregi_replace("&&".$key."&&",$this->_tpl_vars[$key],$this->tpl); 

return $rend_tpl; 


require (""); 

$test = new template; 

echo $test->render(); 


this produces the following output: 

size - 300 
title - 280 
url - sdfdf2 
match - sdfs2d 

sdfs2d &&size&& &&url&& sdfs2d &&title&& 


Obviously the parameter passing works, because the function returns the $key and the value too. As you see only the URL IS SUBSITUTED. I think this could be a bug. 

entry.tpl looks like this: 

bash-2.05$ cat entry.tpl 
&&match&& &&size&& &&url&& &&match&& &&title&& 

Thank you for your response, 



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-15 03:32 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
 [2003-01-15 05:23 UTC] thelucas at directbox dot com
Thank you, the update to the latest version seem to fix this issue.

Best Regards,

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Jul 17 23:01:28 2024 UTC