]> granicus.if.org Git - php/commitdiff
All zend_parse_parameters("Z") has to be replaced with zend_parse_parameters("z")
authorDmitry Stogov <dmitry@zend.com>
Fri, 21 Feb 2014 13:22:02 +0000 (17:22 +0400)
committerDmitry Stogov <dmitry@zend.com>
Fri, 21 Feb 2014 13:22:02 +0000 (17:22 +0400)
Zend/zend_API.c
ext/standard/type.c

index e2737a270caa1a0230d88ea0f0cf49dae744ec89..8a3baff8f474e27863b818f1d2341c8be63b935d 100644 (file)
@@ -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";
        }
index 3fe312644b1604add2b0e4462469a24c973469db..4488d4f1ae4b334382257a617074b7096fdbcc03 100644 (file)
@@ -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;