[PHP-DEV] PHP 4.0 Bug #8472: calling a function in a regular expression From: simon.southwood <email protected>
Date: 12/29/00

From: simon.southwood <email protected>
Operating system: rh 6.02
PHP version: 4.0.0
PHP Bug Type: *Regular Expressions
Bug description: calling a function in a regular expression

function image($arrayRef)
{
$arrayRef += 5;
return $arrayRef;
}
$html="<%image1%>some junk in here<%image2%>even more junk in here<%image3%>and some more for good measure<%image4%>
print(image("34"));
$pat="%image([0-9])%";
$rep="fdg".image("\\1");
$html=ereg_replace($pat, $rep, $html);

/*
the function works fine if "$arrayRef += 5;" is commented out (it returns exactly whatever "\\1" is.
it also works fine when called with either a string or an integer as argument, called outside the regexp function.

however, inside the regexp it always returns 5.

i dunno if this is a bug, if not then i do apologise, and i'll find another way of doing this.
*/

-- 
Edit Bug report at: http://bugs.php.net/?id=8472&edit=1

-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>