From: Dmitry Stogov Date: Fri, 21 Feb 2014 13:22:02 +0000 (+0400) Subject: All zend_parse_parameters("Z") has to be replaced with zend_parse_parameters("z") X-Git-Tag: POST_PHPNG_MERGE~412^2~607 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e03f3712b0b17c3b73865020677f2e3e74fa48e;p=php All zend_parse_parameters("Z") has to be replaced with zend_parse_parameters("z") --- diff --git a/Zend/zend_API.c b/Zend/zend_API.c index e2737a270c..8a3baff8f4 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -223,6 +223,9 @@ ZEND_API char *zend_get_type_by_const(int type) /* {{{ */ ZEND_API char *zend_zval_type_name(const zval *arg) /* {{{ */ { + if (Z_TYPE_P(arg) == IS_REFERENCE) { + arg = Z_REFVAL_P(arg); + } return zend_get_type_by_const(Z_TYPE_P(arg)); } /* }}} */ @@ -701,8 +704,9 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons } break; -//??? +//??? 'Z' iz not supported anymore and should be replaced with 'z' case 'Z': + ZEND_ASSERT(c != 'Z'); default: return "unknown"; } diff --git a/ext/standard/type.c b/ext/standard/type.c index 3fe312644b..4488d4f1ae 100644 --- a/ext/standard/type.c +++ b/ext/standard/type.c @@ -90,34 +90,34 @@ PHP_FUNCTION(gettype) Set the type of the variable */ PHP_FUNCTION(settype) { - zval **var; + zval *var; char *type; int type_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "Zs", &var, &type, &type_len) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &var, &type, &type_len) == FAILURE) { return; } if (!strcasecmp(type, "integer")) { - convert_to_long(*var); + convert_to_long(var); } else if (!strcasecmp(type, "int")) { - convert_to_long(*var); + convert_to_long(var); } else if (!strcasecmp(type, "float")) { - convert_to_double(*var); + convert_to_double(var); } else if (!strcasecmp(type, "double")) { /* deprecated */ - convert_to_double(*var); + convert_to_double(var); } else if (!strcasecmp(type, "string")) { - convert_to_string(*var); + convert_to_string(var); } else if (!strcasecmp(type, "array")) { - convert_to_array(*var); + convert_to_array(var); } else if (!strcasecmp(type, "object")) { - convert_to_object(*var); + convert_to_object(var); } else if (!strcasecmp(type, "bool")) { - convert_to_boolean(*var); + convert_to_boolean(var); } else if (!strcasecmp(type, "boolean")) { - convert_to_boolean(*var); + convert_to_boolean(var); } else if (!strcasecmp(type, "null")) { - convert_to_null(*var); + convert_to_null(var); } else if (!strcasecmp(type, "resource")) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot convert to resource type"); RETURN_FALSE;