com php-src: Merge branch 'PHP-7.4': Zend/zend_compile.c

From: Date: Tue, 08 Oct 2019 13:52:18 +0000
Subject: com php-src: Merge branch 'PHP-7.4': Zend/zend_compile.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-108806@lists.php.net to get a copy of this message
Commit: cffa81e438a5639d50683c8b49b1cf38bfef2143 Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 8 Oct 2019 15:52:18 +0200 Parents: 56ae3f6c4a6e4ebcb4bc07777286f355e7bee3b9 9004102b99be4d3811d69ad61149dc2959579e0a Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=cffa81e438a5639d50683c8b49b1cf38bfef2143 Log: Merge branch 'PHP-7.4' Changed paths: MM Zend/zend_compile.c Diff: diff --cc Zend/zend_compile.c index 906b544a15a,255b89d95f0..b169093de5a --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@@ -5352,29 -5308,6 +5352,31 @@@ static zend_type zend_compile_typename( } /* }}} */ ++/* 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)); + if (Z_TYPE_P(value) == IS_NULL && ZEND_TYPE_ALLOW_NULL(type)) { + return 1; + } + + if (ZEND_TYPE_IS_CLASS(type)) { + return 0; + } + if (ZEND_TYPE_CONTAINS_CODE(type, Z_TYPE_P(value))) { + return 1; + } + 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) { + return 1; + } + return 0; +} + void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */ { zend_ast_list *list = zend_ast_get_list(ast);

« previous php.cvs (#108806) next »