Skip to content

Commit 780db4e

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fix incorrect access of AST_UNPACK
2 parents 48a9c40 + f555544 commit 780db4e

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--TEST--
2+
Spread operator is not supported in destructuring assignments (only spread)
3+
--FILE--
4+
<?php
5+
6+
[...$x] = [1, 2, 3];
7+
8+
?>
9+
--EXPECTF--
10+
Fatal error: Spread operator is not supported in assignments in %s on line %d

Zend/zend_compile.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2939,8 +2939,9 @@ static bool zend_propagate_list_refs(zend_ast *ast) { /* {{{ */
29392939
static bool list_is_keyed(zend_ast_list *list)
29402940
{
29412941
for (uint32_t i = 0; i < list->children; i++) {
2942-
if (list->child[i]) {
2943-
return list->child[i]->child[1] != NULL;
2942+
zend_ast *child = list->child[i];
2943+
if (child) {
2944+
return child->kind == ZEND_AST_ARRAY_ELEM && child->child[1] != NULL;
29442945
}
29452946
}
29462947
return false;

0 commit comments

Comments
 (0)