com php-src: Fix default argument check: Zend/zend_compile. c

From: Date: Fri, 03 Jun 2016 23:01:56 +0000
Subject: com php-src: Fix default argument check: Zend/zend_compile. c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-92301@lists.php.net to get a copy of this message
Commit: bf6a65984ba00ed4bea7dc7968e597c2f02fce0d Author: Aaron Piotrowski <aaron@trowski.com> Fri, 3 Jun 2016 18:01:56 -0500 Parents: 340a00008d05044fa0cc9a7948cf752cad08cb85 Branches: iterable Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bf6a65984ba00ed4bea7dc7968e597c2f02fce0d Log: Fix default argument check Changed paths: M Zend/zend_compile.c Diff: diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index b6627b2..bd4dba8 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5062,14 +5062,6 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */ zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters " "with callable type can only be NULL"); } - } else if (arg_info->type_hint == IS_ITERABLE && default_ast) { - if (default_ast && !has_null_default - && Z_TYPE(default_node.u.constant) != IS_ARRAY - && !Z_CONSTANT(default_node.u.constant) - ) { - zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters " - "with iterable type can only be an array or NULL"); - } } } else { if (default_ast && !has_null_default && !Z_CONSTANT(default_node.u.constant)) { @@ -5083,6 +5075,13 @@ void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast) /* {{{ */ "with a float type can only be float, integer, or NULL"); } break; + + case IS_ITERABLE: + if (Z_TYPE(default_node.u.constant) != IS_ARRAY) { + zend_error_noreturn(E_COMPILE_ERROR, "Default value for parameters " + "with iterable type can only be an array or NULL"); + } + break; default: if (!ZEND_SAME_FAKE_TYPE(arg_info->type_hint, Z_TYPE(default_node.u.constant))) {

« previous php.cvs (#92301) next »