diff options
Diffstat (limited to 'ext/iconv/iconv.c')
-rw-r--r-- | ext/iconv/iconv.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 638160cb69..35e4d943d5 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -2214,39 +2214,31 @@ PHP_FUNCTION(iconv_mime_encode) } } - if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "input-charset", sizeof("input-charset") - 1)) != NULL) { + if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "input-charset", sizeof("input-charset") - 1)) != NULL && Z_TYPE_P(pzval) == IS_STRING) { if (Z_STRLEN_P(pzval) >= ICONV_CSNMAXLEN) { php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN); RETURN_FALSE; } - if (Z_TYPE_P(pzval) == IS_STRING && Z_STRLEN_P(pzval) > 0) { + if (Z_STRLEN_P(pzval) > 0) { in_charset = Z_STRVAL_P(pzval); } } - if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "output-charset", sizeof("output-charset") - 1)) != NULL) { + if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "output-charset", sizeof("output-charset") - 1)) != NULL && Z_TYPE_P(pzval) == IS_STRING) { if (Z_STRLEN_P(pzval) >= ICONV_CSNMAXLEN) { php_error_docref(NULL, E_WARNING, "Charset parameter exceeds the maximum allowed length of %d characters", ICONV_CSNMAXLEN); RETURN_FALSE; } - if (Z_TYPE_P(pzval) == IS_STRING && Z_STRLEN_P(pzval) > 0) { + if (Z_STRLEN_P(pzval) > 0) { out_charset = Z_STRVAL_P(pzval); } } if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "line-length", sizeof("line-length") - 1)) != NULL) { - zval val; - - if (Z_TYPE_P(pzval) != IS_LONG) { - ZVAL_DUP(&val, pzval); - convert_to_long(&val); - pzval = &val; - } - - line_len = Z_LVAL_P(pzval); + line_len = zval_get_long(pzval); } if ((pzval = zend_hash_str_find(Z_ARRVAL_P(pref), "line-break-chars", sizeof("line-break-chars") - 1)) != NULL) { |