ID:               37911
 Updated by:       [EMAIL PROTECTED]
 Reported By:      thomas dot kalka at gmail dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         *Regular Expressions
 Operating System: xubuntu
 PHP Version:      5.1.4
-Assigned To:      
+Assigned To:      andrei


Previous Comments:
------------------------------------------------------------------------

[2006-06-25 21:22:05] thomas dot kalka at gmail dot com

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 this bug report at http://bugs.php.net/?id=37911&edit=1

Reply via email to