diff options
author | Dmitry Stogov <dmitry@zend.com> | 2021-02-24 19:13:11 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2021-02-24 19:13:11 +0300 |
commit | 5caf29a01e8498ecf3cfabceee8cf60a0fd39eb8 (patch) | |
tree | 90d7c6fffb6026367bb1406aeda167b9b6a9219a /Zend | |
parent | 99d0f502dcde51b0a5e96d8f4267d60ed78b8e2b (diff) | |
download | php-git-5caf29a01e8498ecf3cfabceee8cf60a0fd39eb8.tar.gz |
Switch few functions useful in Symphony apps to new ZPP API.
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/zend_builtin_functions.c | 32 | ||||
-rw-r--r-- | Zend/zend_closures.c | 6 |
2 files changed, 20 insertions, 18 deletions
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c index 94a9502bc9..519bf02d88 100644 --- a/Zend/zend_builtin_functions.c +++ b/Zend/zend_builtin_functions.c @@ -1069,23 +1069,25 @@ ZEND_FUNCTION(function_exists) ZEND_FUNCTION(class_alias) { zend_string *class_name; - char *alias_name; + zend_string *alias_name; zend_class_entry *ce; - size_t alias_name_len; bool autoload = 1; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "Ss|b", &class_name, &alias_name, &alias_name_len, &autoload) == FAILURE) { - RETURN_THROWS(); - } + ZEND_PARSE_PARAMETERS_START(2, 3) + Z_PARAM_STR(class_name) + Z_PARAM_STR(alias_name) + Z_PARAM_OPTIONAL + Z_PARAM_BOOL(autoload) + ZEND_PARSE_PARAMETERS_END(); ce = zend_lookup_class_ex(class_name, NULL, !autoload ? ZEND_FETCH_CLASS_NO_AUTOLOAD : 0); if (ce) { if (ce->type == ZEND_USER_CLASS) { - if (zend_register_class_alias_ex(alias_name, alias_name_len, ce, 0) == SUCCESS) { + if (zend_register_class_alias_ex(ZSTR_VAL(alias_name), ZSTR_LEN(alias_name), ce, 0) == SUCCESS) { RETURN_TRUE; } else { - zend_error(E_WARNING, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce), alias_name); + zend_error(E_WARNING, "Cannot declare %s %s, because the name is already in use", zend_get_object_type(ce), ZSTR_VAL(alias_name)); RETURN_FALSE; } } else { @@ -1152,10 +1154,11 @@ ZEND_FUNCTION(set_error_handler) zend_fcall_info_cache fcc; zend_long error_type = E_ALL; - /* callable argument corresponds to the error handler */ - if (zend_parse_parameters(ZEND_NUM_ARGS(), "f!|l", &fci, &fcc, &error_type) == FAILURE) { - RETURN_THROWS(); - } + ZEND_PARSE_PARAMETERS_START(1, 2) + Z_PARAM_FUNC_OR_NULL(fci, fcc) + Z_PARAM_OPTIONAL + Z_PARAM_LONG(error_type) + ZEND_PARSE_PARAMETERS_END(); if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) { ZVAL_COPY(return_value, &EG(user_error_handler)); @@ -1209,10 +1212,9 @@ ZEND_FUNCTION(set_exception_handler) zend_fcall_info fci; zend_fcall_info_cache fcc; - /* callable argument corresponds to the exception handler */ - if (zend_parse_parameters(ZEND_NUM_ARGS(), "f!", &fci, &fcc) == FAILURE) { - RETURN_THROWS(); - } + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_FUNC_OR_NULL(fci, fcc) + ZEND_PARSE_PARAMETERS_END(); if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) { ZVAL_COPY(return_value, &EG(user_exception_handler)); diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 8e5b599e39..452f99e6fb 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -356,9 +356,9 @@ ZEND_METHOD(Closure, fromCallable) zval *callable; char *error = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &callable) == FAILURE) { - RETURN_THROWS(); - } + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_ZVAL(callable) + ZEND_PARSE_PARAMETERS_END(); if (Z_TYPE_P(callable) == IS_OBJECT && instanceof_function(Z_OBJCE_P(callable), zend_ce_closure)) { /* It's already a closure */ |