com php-src: All zend_parse_parameters("Z") has to be replaced with zend_parse_parameters("z "): Zend/zend_API.c ext/standard/type.c
| From: | Dmitry Stogov | Date: | Fri, 21 Feb 2014 13:22:02 +0000 |
| Subject: | com php-src: All zend_parse_parameters("Z") has to be replaced with zend_parse_parameters("z "): Zend/zend_API.c ext/standard/type.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-78003@lists.php.net to get a copy of this message | ||
Commit: 7e03f3712b0b17c3b73865020677f2e3e74fa48e
Author: Dmitry Stogov <dmitry@zend.com> Fri, 21 Feb 2014 17:22:02 +0400
Parents: 6fbea9ce6a6382d7999b6f6059c16348ee50ecda
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7e03f3712b0b17c3b73865020677f2e3e74fa48e
Log:
All zend_parse_parameters("Z") has to be replaced with
zend_parse_parameters("z")
Changed paths:
M Zend/zend_API.c
M ext/standard/type.c
Diff:
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index e2737a2..8a3baff 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 3fe3126..4488d4f 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;