PHP 4.0 Bug #8472 Updated: calling a function in a regular expression

From: Date: Sat, 06 Jan 2001 04:21:01 +0000
Subject: PHP 4.0 Bug #8472 Updated: calling a function in a regular expression
Groups: php.dev 
Request: Send a blank email to php-dev+get-43111@lists.php.net to get a copy of this message
ID: 8472 Updated by: sniper Reported By: simon.southwood@sportal.net Old-Status: Open Status: Feedback Bug Type: *Regular Expressions Assigned To: Comments: Have you tried PHP 4.0.4 ? Does this happen with it? --Jani Previous Comments: --------------------------------------------------------------------------- [2000-12-29 05:18:54] simon.southwood@sportal.net oops $html=$html="<%image1%>some junk in here<%image2%>even more junk in here<%image3%>and some more for good measure<%image4%>"; --------------------------------------------------------------------------- [2000-12-29 04:53:38] simon.southwood@sportal.net 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. */ --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=8472

« previous php.dev (#43111) next »