summaryrefslogtreecommitdiff
path: root/ext/iconv
diff options
context:
space:
mode:
authorNikita Popov <nikic@php.net>2015-04-25 20:43:11 +0200
committerNikita Popov <nikic@php.net>2015-04-27 18:50:08 +0200
commit40e465e3575443757693146bb141a4de02cc697c (patch)
tree6eb7c1fc0ffeb24d3bcf3cc34ecd294c39a2e4e4 /ext/iconv
parent1800bed1045a43d2478c0265a26fe0675fb5a6c1 (diff)
downloadphp-git-40e465e3575443757693146bb141a4de02cc697c.tar.gz
Clean up some type conversions
While at it also fix some type checks in iconv and drop dead and unported code in standard/filters.
Diffstat (limited to 'ext/iconv')
-rw-r--r--ext/iconv/iconv.c18
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) {