summaryrefslogtreecommitdiff
path: root/Zend/zend_API.c
diff options
context:
space:
mode:
authortwosee <twose@qq.com>2020-07-10 13:18:00 +0800
committerNikita Popov <nikita.ppv@gmail.com>2020-07-10 10:12:23 +0200
commitb284ba39436cb3585cbb68a62420f8f8ad664942 (patch)
tree3172950b5cdb088658505c506580652f319e5f49 /Zend/zend_API.c
parentbdcda50304a2a0f3ae65b256507a8540594b69d7 (diff)
downloadphp-git-b284ba39436cb3585cbb68a62420f8f8ad664942.tar.gz
Add zend_wrong_parameter_error to reduce the size of ZPP macro
Closes GH-5831.
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r--Zend/zend_API.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index cbf6bdcd09..3be7f3a807 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -213,6 +213,33 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameters_count_error(int min_
}
/* }}} */
+ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_error(int error_code, int num, char *name, zend_expected_type expected_type, zval *arg) /* {{{ */
+{
+ switch (error_code) {
+ case ZPP_ERROR_WRONG_CALLBACK:
+ zend_wrong_callback_error(num, name);
+ break;
+ case ZPP_ERROR_WRONG_CLASS:
+ zend_wrong_parameter_class_error(num, name, arg);
+ break;
+ case ZPP_ERROR_WRONG_CLASS_OR_NULL:
+ zend_wrong_parameter_class_or_null_error(num, name, arg);
+ break;
+ case ZPP_ERROR_WRONG_ARG:
+ zend_wrong_parameter_type_error(num, expected_type, arg);
+ break;
+ case ZPP_ERROR_WRONG_STRING_OR_CLASS:
+ zend_wrong_parameter_string_or_class_error(num, name, arg);
+ break;
+ case ZPP_ERROR_WRONG_STRING_OR_CLASS_OR_NULL:
+ zend_wrong_parameter_string_or_class_or_null_error(num, name, arg);
+ break;
+ default:
+ ZEND_ASSERT(error_code != ZPP_ERROR_OK);
+ }
+}
+/* }}} */
+
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_wrong_parameter_type_error(int num, zend_expected_type expected_type, zval *arg) /* {{{ */
{
static const char * const expected_error[] = {