From: [EMAIL PROTECTED]
Operating system: 2.4.17-rc2aa2-2g
PHP version: 4.2.0
PHP Bug Type: *Regular Expressions
Bug description: eregi_replace seems not to work correctly
Hello,
eregi_replace does not seem to work correctly for me (php/4.2.0)
template.inc:
...
...
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);
$a=$this->_tpl_vars[$key];
}
return $rend_tpl;
}
test.php:
<?
require ("templates.inc");
$test = new template;
$test->init("entry.tpl");
$test->set("size",300);
$test->set("title",280);
$test->set("url","sdfdf2");
$test->set("match","sdfs2d");
echo $test->render();
?>
this produces the following output:
size - 300
title - 280
url - sdfdf2
match - sdfs2d
sdfs2d &&size&& &&url&& sdfs2d &&title&&
bash-2.05$
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&&
bash-2.05$
Thank you for your response,
Lucas
--
Edit bug report at http://bugs.php.net/?id=21645&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=21645&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=21645&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=21645&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=21645&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=21645&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=21645&r=support
Expected behavior: http://bugs.php.net/fix.php?id=21645&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=21645&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=21645&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=21645&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21645&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=21645&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=21645&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=21645&r=gnused