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