]> granicus.if.org Git - php/commitdiff
Fixed bug #69840 (iconv_substr() doesn't work with UTF-16BE)
authorKalle Sommer Nielsen <kalle@php.net>
Wed, 17 Jun 2015 07:39:45 +0000 (09:39 +0200)
committerKalle Sommer Nielsen <kalle@php.net>
Wed, 17 Jun 2015 07:39:45 +0000 (09:39 +0200)
ext/iconv/iconv.c

index 897185da8a91016cabe2e2d40ab791c7f35c8a8b..8fcc43dd92f427f9bc717030e14b5d3bf27d758c 100644 (file)
@@ -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);