Bug #16040: nested preg_replace_callback()'s won't work

From: Date: Wed, 13 Mar 2002 12:31:50 +0000
Subject: Bug #16040: nested preg_replace_callback()'s won't work
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-2381@lists.php.net to get a copy of this message
From: markus.pfefferle@web.de Operating system: Linux PHP version: 4.1.1 PHP Bug Type: PCRE related Bug description: nested preg_replace_callback()'s won't work A preg_replace_callback() that calls a callback function which in turn makes use of a preg_replace_callback() function too, will not work correctly. The first preg_replace_callback() will substitute gibberisch even though the callback function returned a valid string. Example: function funcB($arr) { ... return $whatever; } function funcA($arr) { ... $t = preg_replace_callback("/%value([0-9]+)%/", "funcB", $someotherhaystack) return $t; // $t still makes sense here } echo preg_replace_callback("/%text([0-9]+)%/", "funcA", $haystack); // but whatever funcA returned, just some gibberisch is substituted for /%text[0-9]+%/ -- Edit bug report at http://bugs.php.net/?id=16040&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=16040&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=16040&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=16040&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=16040&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=16040&r=support Expected behavior: http://bugs.php.net/fix.php?id=16040&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=16040&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=16040&r=submittedtwice

« previous php.bugs (#2381) next »