From ff9e290438afc4c9e3d69bc88e37fd56267fe898 Mon Sep 17 00:00:00 2001 From: Kalle Sommer Nielsen Date: Wed, 17 Jun 2015 09:39:45 +0200 Subject: [PATCH] Fixed bug #69840 (iconv_substr() doesn't work with UTF-16BE) --- ext/iconv/iconv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 897185da8a..8fcc43dd92 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -2109,7 +2109,7 @@ PHP_FUNCTION(iconv_substr) err = _php_iconv_substr(&retval, str->val, str->len, offset, length, charset); _php_iconv_show_error(err, GENERIC_SUPERSET_NAME, charset); - if (err == PHP_ICONV_ERR_SUCCESS && str->val[0] != '\0' && retval.s != NULL) { + if (err == PHP_ICONV_ERR_SUCCESS && str->len > 0 && retval.s != NULL) { RETURN_NEW_STR(retval.s); } smart_str_free(&retval); -- 2.40.0