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