mirror of
https://github.com/php/php-src.git
synced 2024-12-04 23:34:25 +08:00
Adapt test cases for Oniguruma 6.9.4
Apparently, bug 78633 has now really been fixed; the former fix only catered to the buffer overflow, but yielded a wrong result. Also, the order of the named captures has been fixed.
This commit is contained in:
parent
fee38633d2
commit
c55d09c2f5
@ -7,7 +7,12 @@ if (!function_exists('mb_eregi')) die('skip mb_eregi function not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(mb_eregi(".+Isssǰ", ".+Isssǰ"));
|
||||
$res = mb_eregi(".+Isssǰ", ".+Isssǰ");
|
||||
if ($res === 1 || $res === false) {
|
||||
echo "ok\n";
|
||||
} else {
|
||||
var_dump($res);
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
ok
|
||||
|
@ -4,6 +4,7 @@ Testing mb_ereg_search() named capture groups
|
||||
<?php
|
||||
if (!extension_loaded('mbstring')) die('skip mbstring not enabled');
|
||||
function_exists('mb_ereg_search') or die("skip mb_ereg_search() is not available in this build");
|
||||
version_compare(MB_ONIGURUMA_VERSION, '6.9.4', '<') or die("skip requires oniguruma < 6.9.4");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
32
ext/mbstring/tests/mb_ereg_search_named_subpatterns_2.phpt
Normal file
32
ext/mbstring/tests/mb_ereg_search_named_subpatterns_2.phpt
Normal file
@ -0,0 +1,32 @@
|
||||
--TEST--
|
||||
Testing mb_ereg_search() named capture groups
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('mbstring')) die('skip mbstring not enabled');
|
||||
function_exists('mb_ereg_search') or die("skip mb_ereg_search() is not available in this build");
|
||||
version_compare(MB_ONIGURUMA_VERSION, '6.9.4', '>=') or die("skip requires oniguruma >= 6.9.4");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
mb_regex_encoding("UTF-8");
|
||||
mb_ereg_search_init(' 中国?');
|
||||
mb_ereg_search('(?<wsp>\s*)(?<word>\w+)(?<punct>[?!])');
|
||||
var_dump(mb_ereg_search_getregs());
|
||||
?>
|
||||
--EXPECT--
|
||||
array(7) {
|
||||
[0]=>
|
||||
string(11) " 中国?"
|
||||
[1]=>
|
||||
string(2) " "
|
||||
[2]=>
|
||||
string(6) "中国"
|
||||
[3]=>
|
||||
string(3) "?"
|
||||
["wsp"]=>
|
||||
string(2) " "
|
||||
["word"]=>
|
||||
string(6) "中国"
|
||||
["punct"]=>
|
||||
string(3) "?"
|
||||
}
|
Loading…
Reference in New Issue
Block a user