diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-11-24 10:10:01 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-11-24 10:10:01 +0100 |
commit | 679bb568586639c83175fe2f9e2ff2a510492d46 (patch) | |
tree | 45fc251f508a04178821d01094c643a185a02aad | |
parent | 756261cf9a85d400587bede611156ebd104f582b (diff) | |
parent | 912cb8b8b52f958ac6eb482466c01e99fc0c0e35 (diff) | |
download | php-git-679bb568586639c83175fe2f9e2ff2a510492d46.tar.gz |
Merge branch 'PHP-8.0'
* PHP-8.0:
Fixed bug #80391
-rw-r--r-- | Zend/tests/bug80391.phpt | 23 | ||||
-rw-r--r-- | Zend/zend_inheritance.c | 4 |
2 files changed, 27 insertions, 0 deletions
diff --git a/Zend/tests/bug80391.phpt b/Zend/tests/bug80391.phpt new file mode 100644 index 0000000000..f483ed80fc --- /dev/null +++ b/Zend/tests/bug80391.phpt @@ -0,0 +1,23 @@ +--TEST-- +Iterable not covariant to mixed +--FILE-- +<?php + +class A { + public function method1(): mixed {} + public function method2(): array|object {} + public function method3(iterable $x) {} + public function method4(iterable $x) {} +} + +class B extends A { + public function method1(): iterable {} + public function method2(): iterable {} + public function method3(mixed $x) {} + public function method4(array|object $x) {} +} + +?> +===DONE=== +--EXPECT-- +===DONE=== diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 7401456d8f..882738b758 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -323,6 +323,10 @@ static zend_bool unlinked_instanceof(zend_class_entry *ce1, zend_class_entry *ce static zend_bool zend_type_contains_traversable(zend_type type) { zend_type *single_type; + if (ZEND_TYPE_FULL_MASK(type) & MAY_BE_OBJECT) { + return 1; + } + ZEND_TYPE_FOREACH(type, single_type) { if (ZEND_TYPE_HAS_NAME(*single_type) && zend_string_equals_literal_ci(ZEND_TYPE_NAME(*single_type), "Traversable")) { |