Skip to content

Commit 0350f89

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

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Zend/zend_inheritance.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@ int _check_inherited_arg_info(
320320
_resolve_parent_and_self(proto, ZEND_TYPE_NAME(proto_type));
321321
zend_class_entry *proto_ce = zend_lookup_class(proto_class_name);
322322
zend_string_release(proto_class_name);
323-
return proto_ce && instanceof_function(proto_ce, zend_ce_traversable);
323+
return proto_ce
324+
? instanceof_function(proto_ce, zend_ce_traversable)
325+
: -1;
324326
} else if (fe_type_code == IS_OBJECT) {
325327
return 1;
326328
}

0 commit comments

Comments
 (0)