mirror of
https://github.com/php/php-src.git
synced 2026-03-26 09:12:14 +01:00
This test is somewhat fragile in that it depends on how well a particular regex is optimized. Apparently on 6.9.1 this regex would hit the default retry_limit of 1000000 already. I'm limiting this to 6.9.3 because that's the version that works for me.
24 lines
516 B
PHP
24 lines
516 B
PHP
--TEST--
|
|
Oniguruma retry limit
|
|
--SKIPIF--
|
|
<?php
|
|
extension_loaded('mbstring') or die('skip mbstring not available');
|
|
if (!function_exists('mb_ereg')) die('skip mb_ereg not available');
|
|
if (version_compare(MB_ONIGURUMA_VERSION, '6.9.3') < 0) {
|
|
die('skip requires Oniguruma >= 6.9.3');
|
|
}
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$regex = 'A(B|C+)+D|AC+X';
|
|
$str = 'ACCCCCCCCCCCCCCCCCCCX';
|
|
var_dump(mb_ereg($regex, $str));
|
|
ini_set('mbstring.regex_retry_limit', '100000');
|
|
var_dump(mb_ereg($regex, $str));
|
|
|
|
?>
|
|
--EXPECT--
|
|
int(1)
|
|
bool(false)
|