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