From: [EMAIL PROTECTED] 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