diff options
| author | Xinchen Hui <laruence@gmail.com> | 2016-06-14 14:02:34 +0800 |
|---|---|---|
| committer | Xinchen Hui <laruence@gmail.com> | 2016-06-14 14:02:34 +0800 |
| commit | 9c8e1c03b97fea34432ed8a91e8ddd9b9d20a649 (patch) | |
| tree | 4a2ffbaadcd5d8c718cedd20d922e9f16ab473eb /Zend/zend_compile.c | |
| parent | 14e790a0753dce4dfaeff1b2d8f9800b519917c1 (diff) | |
| download | php-git-9c8e1c03b97fea34432ed8a91e8ddd9b9d20a649.tar.gz | |
Only allow single comma in tail
Diffstat (limited to 'Zend/zend_compile.c')
| -rw-r--r-- | Zend/zend_compile.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 63bd813092..962f2eea66 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2762,10 +2762,7 @@ static void zend_verify_list_assign_target(zend_ast *var_ast, zend_bool old_styl static void zend_compile_unkeyed_list_assign(zend_ast_list *list, znode *expr_node, zend_bool old_style) /* {{{ */ { uint32_t i; - - if (list->children == 0) { - zend_error_noreturn(E_COMPILE_ERROR, "Cannot use empty list"); - } + zend_bool has_elems = 0; for (i = 0; i < list->children; ++i) { zend_ast *elem_ast = list->child[i]; @@ -2780,6 +2777,7 @@ static void zend_compile_unkeyed_list_assign(zend_ast_list *list, znode *expr_no } var_ast = elem_ast->child[0]; + has_elems = 1; dim_node.op_type = IS_CONST; ZVAL_LONG(&dim_node.u.constant, i); @@ -2797,6 +2795,11 @@ static void zend_compile_unkeyed_list_assign(zend_ast_list *list, znode *expr_no zend_emit_op(&fetch_result, ZEND_FETCH_LIST, expr_node, &dim_node); zend_emit_assign_znode(var_ast, &fetch_result); } + + if (has_elems == 0) { + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use empty list"); + } + } /* }}} */ |
