Skip to content

Commit b35b014

Browse files
committed
Require all internal functions to have arginfo
1 parent 8d30d5f commit b35b014

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

UPGRADING.INTERNALS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ PHP 8.0 INTERNALS UPGRADE NOTES
1313
j. compare_objects() and compare() object handlers
1414
k. The 'I' length modifier
1515
l. Some VM instructions switched to IS_TMP_VAR result instead of IS_VAR
16+
m. All internal functions must have arginfo
1617

1718
2. Build system changes
1819
a. Abstract
@@ -98,6 +99,9 @@ PHP 8.0 INTERNALS UPGRADE NOTES
9899
pre increments/decrements (ZEND_PRE_INC, ZEND_PRE_DEC, ZEND_PRE_INC_OBJ
99100
ZEND_PRE_DEC_OBJ, ZEND_PRE_INC_STATIC_PROP ZEND_PRE_DEC_STATIC_PROP).
100101

102+
m. All internal functions and methods are now required to specify arginfo
103+
information, otherwise warnings will be thrown on startup.
104+
101105
========================
102106
2. Build system changes
103107
========================

Zend/zend_API.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2042,9 +2042,9 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
20422042
} else {
20432043
internal_function->fn_flags = ZEND_ACC_PUBLIC;
20442044
}
2045+
20452046
if (ptr->arg_info) {
20462047
zend_internal_function_info *info = (zend_internal_function_info*)ptr->arg_info;
2047-
20482048
internal_function->arg_info = (zend_internal_arg_info*)ptr->arg_info+1;
20492049
internal_function->num_args = ptr->num_args;
20502050
/* 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
20722072
internal_function->fn_flags |= ZEND_ACC_HAS_RETURN_TYPE;
20732073
}
20742074
} else {
2075+
zend_error(E_CORE_WARNING, "Missing arginfo for %s%s%s()",
2076+
scope ? ZSTR_VAL(scope->name) : "", scope ? "::" : "", ptr->fname);
2077+
20752078
internal_function->arg_info = NULL;
20762079
internal_function->num_args = 0;
20772080
internal_function->required_num_args = 0;
20782081
}
2082+
20792083
zend_set_function_arg_flags((zend_function*)internal_function);
20802084
if (ptr->flags & ZEND_ACC_ABSTRACT) {
20812085
if (scope) {

Zend/zend_inheritance.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -530,14 +530,6 @@ static inheritance_status zend_do_perform_implementation_check(
530530
inheritance_status status, local_status;
531531
zend_bool proto_is_variadic, fe_is_variadic;
532532

533-
/* If it's a user function then arg_info == NULL means we don't have any parameters but
534-
* we still need to do the arg number checks. We are only willing to ignore this for internal
535-
* functions because extensions don't always define arg_info.
536-
*/
537-
if (!proto->common.arg_info && proto->common.type != ZEND_USER_FUNCTION) {
538-
return INHERITANCE_SUCCESS;
539-
}
540-
541533
/* Checks for constructors only if they are declared in an interface,
542534
* or explicitly marked as abstract
543535
*/

0 commit comments

Comments
 (0)