ID: 45748 Updated by: [EMAIL PROTECTED] Reported By: xxorax at gmail dot com -Status: Open +Status: Closed Bug Type: PCRE related Operating System: * PHP Version: 5.2.6 New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. This had been fixed in 5.3 but not in older branches. This is now fixed in 5.2 and will be available in future 5.2 snapshots. Previous Comments: ------------------------------------------------------------------------ [2008-08-07 23:34:59] xxorax at gmail dot com Description: ------------ named subpattern is not passed with their names in the array of the callback function in preg_replace_callback. this is the same bug of Bug #37911 (1 year) but it is not fixed ! thanks Reproduce code: --------------- $regex = '#(?P<int>\d+):(?P<text>\w+)#'; $data = <<<TEST zedz:fzef 234:zefrfr 13232erf:erfrfe 345345:rgrtgtr TEST; function func ($m) { print_r($m); return "match"; } echo $data."\n"; echo preg_replace_callback($regex, 'func', $data); Expected result: ---------------- zedz:fzef 234:zefrfr 13232erf:erfrfe 345345:rgrtgtr Array ( [0] => 234:zefrfr [int] => 234 [text] => zefrfr ) Array ( [0] => 345345:rgrtgtr [int] => 345345 [text] => rgrtgtr ) zedz:fzef match 13232erf:erfrfe match Actual result: -------------- zedz:fzef 234:zefrfr 13232erf:erfrfe 345345:rgrtgtr Array ( [0] => 234:zefrfr [1] => 234 [2] => zefrfr ) Array ( [0] => 345345:rgrtgtr [1] => 345345 [2] => rgrtgtr ) zedz:fzef match 13232erf:erfrfe match ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45748&edit=1