Merge branch 'PHP-5.6' into PHP-7.0

This commit is contained in:
Christoph M. Becker 2016-08-30 14:54:44 +02:00
commit 972302d2f0
3 changed files with 33 additions and 0 deletions

3
NEWS
View File

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

View File

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

View 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==