1
0
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:
Nikita Popov
2019-09-19 17:22:34 +02:00
2 changed files with 19 additions and 1 deletions

View File

@@ -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;
}

View 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