Skip to content

Commit 38fb1f8

Browse files
committed
Check for missing arginfo arguments
Internal functions error when too many arguments are passed. Make this part of the verification we do in debug builds. This will help avoid cases where an argument is missing in the stubs, as recently encountered in 6d96f0f.
1 parent be0d912 commit 38fb1f8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Zend/zend_execute.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static ZEND_FUNCTION(pass)
130130
ZEND_API const zend_internal_function zend_pass_function = {
131131
ZEND_INTERNAL_FUNCTION, /* type */
132132
{0, 0, 0}, /* arg_flags */
133-
0, /* fn_flags */
133+
ZEND_ACC_VARIADIC, /* fn_flags */
134134
NULL, /* name */
135135
NULL, /* scope */
136136
NULL, /* prototype */
@@ -1122,6 +1122,14 @@ static zend_never_inline ZEND_ATTRIBUTE_UNUSED int zend_verify_internal_arg_type
11221122
static zend_always_inline zend_bool zend_internal_call_should_throw(zend_function *fbc, zend_execute_data *call)
11231123
{
11241124
if (fbc->common.required_num_args > ZEND_CALL_NUM_ARGS(call)) {
1125+
/* Required argument not passed. */
1126+
return 1;
1127+
}
1128+
1129+
if (fbc->common.num_args < ZEND_CALL_NUM_ARGS(call)
1130+
&& !(fbc->common.fn_flags & ZEND_ACC_VARIADIC)) {
1131+
/* Too many arguments passed. For internal functions (unlike userland functions),
1132+
* this should always throw. */
11251133
return 1;
11261134
}
11271135

0 commit comments

Comments
 (0)