Annotation of embedaddon/php/ext/pcre/tests/bug37911.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #37911 (preg_replace_callback ignores named groups)
3: --FILE--
4: <?php
5:
6: function callback($match)
7: {
8: var_dump($match);
9: return $match[1].'/'.strlen($match['name']);
10: }
11:
12: var_dump(preg_replace_callback('|(?P<name>blub)|', 'callback', 'bla blub blah'));
13:
14: var_dump(preg_match('|(?P<name>blub)|', 'bla blub blah', $m));
15: var_dump($m);
16:
17: var_dump(preg_replace_callback('|(?P<1>blub)|', 'callback', 'bla blub blah'));
18:
19: ?>
20: --EXPECTF--
21: array(3) {
22: [0]=>
23: string(4) "blub"
24: ["name"]=>
25: string(4) "blub"
26: [1]=>
27: string(4) "blub"
28: }
29: string(15) "bla blub/4 blah"
30: int(1)
31: array(3) {
32: [0]=>
33: string(4) "blub"
34: ["name"]=>
35: string(4) "blub"
36: [1]=>
37: string(4) "blub"
38: }
39:
40: Warning: preg_replace_callback(): Numeric named subpatterns are not allowed in %sbug37911.php on line 14
41: NULL
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>