From: thomas dot kalka at gmail dot com Operating system: xubuntu PHP version: 5.1.4 PHP Bug Type: *Regular Expressions Bug description: preg_replace_callback ignores named groups
Description: ------------ unfortunately preg_replace_callback does not handle named groups Reproduce code: --------------- <?php $a = "bla blub blah"; $regex = '|(?P<name>blub)|'; function callback($match) { var_dump($match); return '-'; } preg_replace_callback($regex,'callback',$a); $m = array(); preg_match($regex,$a,$m); var_dump($m); ?> Expected result: ---------------- array(3) { [0]=> string(4) "blub" ["name"]=> string(4) "blub" [1]=> string(4) "blub" } array(3) { [0]=> string(4) "blub" ["name"]=> string(4) "blub" [1]=> string(4) "blub" } Actual result: -------------- array(2) { [0]=> string(4) "blub" [1]=> string(4) "blub" } array(3) { [0]=> string(4) "blub" ["name"]=> string(4) "blub" [1]=> string(4) "blub" } -- Edit bug report at http://bugs.php.net/?id=37911&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37911&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37911&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37911&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37911&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37911&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37911&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37911&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37911&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37911&r=support Expected behavior: http://bugs.php.net/fix.php?id=37911&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37911&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37911&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37911&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37911&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37911&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37911&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37911&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37911&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37911&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37911&r=mysqlcfg