summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-02-13 16:38:51 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-02-26 10:05:20 +0100
commitb35b0142e68458475df03c24e622f1c4173ff68b (patch)
treee765dfdfde4fe27698789885ebf0f9e7df33a51e
parent8d30d5f26944f98ef370cc09a638461510e9ad2b (diff)
downloadphp-git-b35b0142e68458475df03c24e622f1c4173ff68b.tar.gz
Require all internal functions to have arginfo
-rw-r--r--UPGRADING.INTERNALS4
-rw-r--r--Zend/zend_API.c6
-rw-r--r--Zend/zend_inheritance.c8
3 files changed, 9 insertions, 9 deletions
diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS
index 6381b22d37..af8c5218c2 100644
--- a/UPGRADING.INTERNALS
+++ b/UPGRADING.INTERNALS
@@ -13,6 +13,7 @@ PHP 8.0 INTERNALS UPGRADE NOTES
j. compare_objects() and compare() object handlers
k. The 'I' length modifier
l. Some VM instructions switched to IS_TMP_VAR result instead of IS_VAR
+ m. All internal functions must have arginfo
2. Build system changes
a. Abstract
@@ -98,6 +99,9 @@ PHP 8.0 INTERNALS UPGRADE NOTES
pre increments/decrements (ZEND_PRE_INC, ZEND_PRE_DEC, ZEND_PRE_INC_OBJ
ZEND_PRE_DEC_OBJ, ZEND_PRE_INC_STATIC_PROP ZEND_PRE_DEC_STATIC_PROP).
+ m. All internal functions and methods are now required to specify arginfo
+ information, otherwise warnings will be thrown on startup.
+
========================
2. Build system changes
========================
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 595208033b..a739303cf3 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -2042,9 +2042,9 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
} else {
internal_function->fn_flags = ZEND_ACC_PUBLIC;
}
+
if (ptr->arg_info) {
zend_internal_function_info *info = (zend_internal_function_info*)ptr->arg_info;
-
internal_function->arg_info = (zend_internal_arg_info*)ptr->arg_info+1;
internal_function->num_args = ptr->num_args;
/* Currently you cannot denote that the function can accept less arguments than num_args */
@@ -2072,10 +2072,14 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
internal_function->fn_flags |= ZEND_ACC_HAS_RETURN_TYPE;
}
} else {
+ zend_error(E_CORE_WARNING, "Missing arginfo for %s%s%s()",
+ scope ? ZSTR_VAL(scope->name) : "", scope ? "::" : "", ptr->fname);
+
internal_function->arg_info = NULL;
internal_function->num_args = 0;
internal_function->required_num_args = 0;
}
+
zend_set_function_arg_flags((zend_function*)internal_function);
if (ptr->flags & ZEND_ACC_ABSTRACT) {
if (scope) {
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index 219c1ffcc9..587d4b2634 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -530,14 +530,6 @@ static inheritance_status zend_do_perform_implementation_check(
inheritance_status status, local_status;
zend_bool proto_is_variadic, fe_is_variadic;
- /* If it's a user function then arg_info == NULL means we don't have any parameters but
- * we still need to do the arg number checks. We are only willing to ignore this for internal
- * functions because extensions don't always define arg_info.
- */
- if (!proto->common.arg_info && proto->common.type != ZEND_USER_FUNCTION) {
- return INHERITANCE_SUCCESS;
- }
-
/* Checks for constructors only if they are declared in an interface,
* or explicitly marked as abstract
*/