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:
Christoph M. Becker 2019-11-29 16:47:10 +01:00
parent fee38633d2
commit c55d09c2f5
3 changed files with 40 additions and 2 deletions

View File

@ -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

View File

@ -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

View 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) ""
}