mirror of
https://github.com/php/php-src.git
synced 2024-12-15 12:54:57 +08:00
2f10db36af
`from` and `len` are `long`, but get passed to mbfl_substr() which expects `int`s. Therefore we clamp the values to avoid the undefined conversion behavior.
24 lines
507 B
PHP
24 lines
507 B
PHP
--TEST--
|
|
Bug #66797 (mb_substr only takes 32-bit signed integer)
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('mbstring')) die('skip mbstring extension not available');
|
|
if (PHP_INT_SIZE != 8) die('skip this test is for 64bit platforms only');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
var_dump(
|
|
mb_substr('bar', 0, 0x7fffffff),
|
|
mb_substr('bar', 0, 0x80000000),
|
|
mb_substr('bar', 0xffffffff, 1),
|
|
mb_substr('bar', 0x100000000, 1)
|
|
);
|
|
?>
|
|
==DONE==
|
|
--EXPECTF--
|
|
string(3) "bar"
|
|
string(3) "bar"
|
|
string(0) ""
|
|
string(0) ""
|
|
==DONE==
|