Merge branch 'PHP-7.4'

This commit is contained in:
Nikita Popov 2019-10-08 15:52:18 +02:00
commit cffa81e438
2 changed files with 19 additions and 2 deletions

View File

@ -10,7 +10,22 @@ class Foo {
public bool $bool = false;
public iterable $iter = [];
}
echo "ok\n";
var_dump(new Foo);
?>
--EXPECT--
ok
object(Foo)#1 (6) {
["int"]=>
int(1)
["flt"]=>
float(2.2)
["flt2"]=>
float(2)
["arr"]=>
array(0) {
}
["bool"]=>
bool(false)
["iter"]=>
array(0) {
}
}

View File

@ -5352,6 +5352,7 @@ static zend_type zend_compile_typename(zend_ast *ast, zend_bool force_allow_null
}
/* }}} */
/* May convert value from int to float. */
static zend_bool zend_is_valid_default_value(zend_type type, zval *value)
{
ZEND_ASSERT(ZEND_TYPE_IS_SET(type));
@ -5367,6 +5368,7 @@ static zend_bool zend_is_valid_default_value(zend_type type, zval *value)
}
if ((ZEND_TYPE_MASK(type) & MAY_BE_DOUBLE) && Z_TYPE_P(value) == IS_LONG) {
/* Integers are allowed as initializers for floating-point values. */
convert_to_double(value);
return 1;
}
if ((ZEND_TYPE_MASK(type) & MAY_BE_ITERABLE) && Z_TYPE_P(value) == IS_ARRAY) {