1
0
mirror of https://github.com/php/php-src.git synced 2026-03-31 04:32:19 +02:00
Files
archived-php-src/ext/mbstring/tests/bug77367.phpt
Christoph M. Becker e617f03066 Fix #77367: Negative size parameter in mb_split
When adding the last element to the result value of `mb_split`, the
`chunk_pos` may point beyond the end of the string, in which case the
unsigned `n` would underflow.  Therefore, we check whether this is the
case in the first place, and only calculate `n` otherwise.  Since `n`
is no longer used outside the block, we move its declaration inside.
2019-01-06 12:24:15 -08:00

22 lines
394 B
PHP

--TEST--
Bug #77367 (Negative size parameter in mb_split)
--SKIPIF--
<?php
if (!extension_loaded('mbstring')) die('mbstring extension not available');
if (!function_exists('mb_split')) die('mb_split() not available');
?>
--FILE--
<?php
mb_regex_encoding('UTF-8');
var_dump(mb_split("\\w", "\xfc"));
?>
===DONE===
--EXPECT--
array(2) {
[0]=>
string(0) ""
[1]=>
string(0) ""
}
===DONE===