xref: /PHP-8.3/ext/mbstring/tests/bug72693.phpt (revision 74859783)
1--TEST--
2Bug #72693 (mb_ereg_search increments search position when 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
11mb_ereg_search_init('foo');
12
13var_dump(mb_ereg_search('\A'));
14var_dump(mb_ereg_search_getpos());
15
16var_dump(mb_ereg_search('\s*'));
17var_dump(mb_ereg_search_getpos());
18
19var_dump(mb_ereg_search('\w+'));
20var_dump(mb_ereg_search_getpos());
21var_dump(mb_ereg_search_getregs());
22
23var_dump(mb_ereg_search('\s*'));
24var_dump(mb_ereg_search_getpos());
25
26var_dump(mb_ereg_search('\Z'));
27var_dump(mb_ereg_search_getpos());
28?>
29--EXPECT--
30bool(true)
31int(0)
32bool(true)
33int(0)
34bool(true)
35int(3)
36array(1) {
37  [0]=>
38  string(3) "foo"
39}
40bool(true)
41int(3)
42bool(true)
43int(3)
44