mirror of
https://github.com/php/php-src.git
synced 2026-03-30 20:22:36 +02:00
Merge branch 'PHP-7.4'
This commit is contained in:
@@ -321,7 +321,8 @@ static inline zend_bool can_elide_return_type_check(
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ZEND_TYPE_CODE(info->type) == IS_CALLABLE) {
|
||||
/* These types are not represented exactly */
|
||||
if (ZEND_TYPE_CODE(info->type) == IS_CALLABLE || ZEND_TYPE_CODE(info->type) == IS_ITERABLE) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
17
ext/opcache/tests/iterable_type_optimization.phpt
Normal file
17
ext/opcache/tests/iterable_type_optimization.phpt
Normal file
@@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Don't optimize object -> iterable
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test(object $arg): iterable {
|
||||
return $arg;
|
||||
}
|
||||
test(new stdClass);
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught TypeError: Return value of test() must be iterable, object returned in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): test(Object(stdClass))
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
Reference in New Issue
Block a user