Skip to content

Commit 2e2fb44

Browse files
committed
Fix covariant check with iterable
Fixes this under opcache: class A { function m(): iterable {} } class B extends A { function m(): Traversable {} } Also fixes cases where B::m is Iterator, IteratorAggregate, etc.
1 parent 0350f89 commit 2e2fb44

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Zend/zend_inheritance.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ int _check_inherited_arg_info(
303303
} else if (variance == COVARIANT) {
304304
if (proto_type_code == IS_ITERABLE) {
305305
zend_class_entry * fe_ce = zend_lookup_class(fe_class_name);
306-
code = fe_ce && instanceof_function(fe_ce, zend_ce_traversable);
306+
code = fe_ce ? instanceof_function(fe_ce, zend_ce_traversable) : -1;
307307
} else if (proto_type_code != IS_OBJECT) {
308308
code = 0;
309309
}
@@ -336,7 +336,7 @@ int _check_inherited_arg_info(
336336

337337
return 0;
338338
}
339-
/* }}} */
339+
/* }}} */
340340

341341
static
342342
int _check_inherited_return_type(

0 commit comments

Comments
 (0)