1--TEST--
2Test oniguruma stack limit
3--SKIPIF--
4<?php
5extension_loaded('mbstring') or die('skip mbstring not available');
6if (!function_exists('mb_ereg')) die('skip mb_ereg not available');
7if (version_compare(MB_ONIGURUMA_VERSION, '6.9.3') < 0) {
8    die('skip requires Oniguruma 6.9.3');
9}
10?>
11--FILE--
12<?php
13$s = str_repeat(' ', 30000);
14
15ini_set('mbstring.regex_stack_limit', 10000);
16var_dump(mb_ereg('\\s+$', $s));
17
18ini_set('mbstring.regex_stack_limit', 30000);
19var_dump(mb_ereg('\\s+$', $s));
20
21ini_set('mbstring.regex_stack_limit', 30001);
22var_dump(mb_ereg('\\s+$', $s));
23
24echo 'OK';
25?>
26--EXPECT--
27bool(false)
28bool(false)
29int(1)
30OK
31