xref: /PHP-5.6/ext/mbstring/tests/bug72691.phpt (revision 56cdaecb)
1--TEST--
2Bug #72691 (mb_ereg_search raises a warning if a match zero-width)
3--SKIPIF--
4<?php
5if (!extension_loaded('mbstring')) die('skip ext/mbstring required');
6?>
7--FILE--
8<?php
9$str = 'foo';
10mb_ereg_search_init($str);
11
12mb_ereg_search('\A');
13var_dump(mb_ereg_search_getpos());
14var_dump(mb_ereg_search_getregs());
15
16mb_ereg_search('\s*');
17var_dump(mb_ereg_search_getpos());
18var_dump(mb_ereg_search_getregs());
19
20mb_ereg_search('\w+');
21var_dump(mb_ereg_search_getpos());
22var_dump(mb_ereg_search_getregs());
23
24mb_ereg_search('\Z');
25var_dump(mb_ereg_search_getpos());
26var_dump(mb_ereg_search_getregs());
27?>
28--EXPECT--
29int(0)
30array(1) {
31  [0]=>
32  string(0) ""
33}
34int(0)
35array(1) {
36  [0]=>
37  string(0) ""
38}
39int(3)
40array(1) {
41  [0]=>
42  string(3) "foo"
43}
44int(3)
45array(1) {
46  [0]=>
47  string(0) ""
48}
49