mirror of
https://github.com/php/php-src.git
synced 2024-12-18 06:21:41 +08:00
Merge branch 'PHP-5.6' into PHP-7.0
This commit is contained in:
commit
972302d2f0
3
NEWS
3
NEWS
@ -2,6 +2,9 @@ PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? 2016 PHP 7.0.12
|
||||
|
||||
- mbstring:
|
||||
. Fixed bug #66797 (mb_substr only takes 32-bit signed integer). (cmb)
|
||||
|
||||
- Standard:
|
||||
. Fixed bug #71882 (Negative ftruncate() on php://memory exhausts memory).
|
||||
(cmb)
|
||||
|
@ -2923,6 +2923,13 @@ PHP_FUNCTION(mb_substr)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (from > INT_MAX) {
|
||||
from = INT_MAX;
|
||||
}
|
||||
if (len > INT_MAX) {
|
||||
len = INT_MAX;
|
||||
}
|
||||
|
||||
ret = mbfl_substr(&string, &result, from, len);
|
||||
if (NULL == ret) {
|
||||
RETURN_FALSE;
|
||||
|
23
ext/mbstring/tests/bug66797.phpt
Normal file
23
ext/mbstring/tests/bug66797.phpt
Normal file
@ -0,0 +1,23 @@
|
||||
--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==
|
Loading…
Reference in New Issue
Block a user