mirror of
https://github.com/php/php-src.git
synced 2026-04-30 03:33:17 +02:00
Merge branch 'PHP-7.0' into PHP-7.1
This commit is contained in:
@@ -24,6 +24,9 @@ PHP NEWS
|
||||
images). (cmb)
|
||||
. Fixed bug #68716 (possible resource leaks in _php_image_convert()). (cmb)
|
||||
|
||||
- iconv:
|
||||
. Fixed bug #72320 (iconv_substr returns false for empty strings). (cmb)
|
||||
|
||||
- Intl:
|
||||
. Fixed bug #65732 (grapheme_*() is not Unicode compliant on CR LF
|
||||
sequence). (cmb)
|
||||
|
||||
+2
-2
@@ -858,7 +858,7 @@ static php_iconv_err_t _php_iconv_substr(smart_str *pretval,
|
||||
}
|
||||
|
||||
|
||||
if ((size_t)offset >= total_len) {
|
||||
if ((size_t)offset > total_len) {
|
||||
return PHP_ICONV_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -2108,7 +2108,7 @@ PHP_FUNCTION(iconv_substr)
|
||||
err = _php_iconv_substr(&retval, ZSTR_VAL(str), ZSTR_LEN(str), offset, length, charset);
|
||||
_php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset);
|
||||
|
||||
if (err == PHP_ICONV_ERR_SUCCESS && ZSTR_LEN(str) > 0 && retval.s != NULL) {
|
||||
if (err == PHP_ICONV_ERR_SUCCESS && ZSTR_LEN(str) >= 0 && retval.s != NULL) {
|
||||
RETURN_NEW_STR(retval.s);
|
||||
}
|
||||
smart_str_free(&retval);
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #72320 (iconv_substr returns false for empty strings)
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('iconv')) die('skip ext/iconv required');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(iconv_substr('', 0, 10, 'UTF-8'));
|
||||
var_dump(iconv_substr('foo', 3, 10, 'UTF-8'));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(0) ""
|
||||
string(0) ""
|
||||
Reference in New Issue
Block a user