Skip to content

Commit 8b07b68

Browse files
committed
Skip variance checks for internal methods that are missing arginfo
1 parent acd3ec6 commit 8b07b68

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

Zend/zend_inheritance.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,12 @@ int _check_inherited_return_type(
351351
return _check_inherited_arg_info(fe, fe_arg_info, proto, proto_arg_info, COVARIANT);
352352
}
353353

354+
355+
static zend_bool _missing_internal_arginfo(zend_function const *fn)
356+
{
357+
return !fn->common.arg_info && fn->common.type == ZEND_INTERNAL_FUNCTION;
358+
}
359+
354360
static
355361
int _check_inherited_parameter_type(
356362
const zend_function *fe, zend_arg_info *fe_arg_info,
@@ -384,7 +390,7 @@ static int zend_do_perform_implementation_check(const zend_function *fe, const z
384390
* we still need to do the arg number checks. We are only willing to ignore this for internal
385391
* functions because extensions don't always define arg_info.
386392
*/
387-
if (!proto->common.arg_info && proto->common.type != ZEND_USER_FUNCTION) {
393+
if (_missing_internal_arginfo(proto)) {
388394
return 1;
389395
}
390396

@@ -2035,8 +2041,18 @@ ZEND_API void zend_verify_variance(zend_class_entry *ce) /* {{{ */
20352041

20362042
ZEND_HASH_FOREACH_PTR(&ce->function_table, child) {
20372043
zend_function *parent = child->common.prototype;
2038-
/* If the parenttype method is private do not enforce a signature */
2039-
if (parent && !(parent ->common.fn_flags & ZEND_ACC_PRIVATE)) {
2044+
if (!parent) {
2045+
continue;
2046+
}
2047+
2048+
/* We are only willing to ignore this for internal functions because
2049+
* extensions don't always define arg_info. */
2050+
if (_missing_internal_arginfo(parent)) {
2051+
continue;
2052+
}
2053+
2054+
/* If the parenttype method is private do not enforce a signature */
2055+
if (parent ->common.fn_flags & ZEND_ACC_PRIVATE) {
20402056
uint32_t i, num_args;
20412057

20422058
/* Checks for constructors only if they are declared in an interface,

0 commit comments

Comments
 (0)