Skip to content

Commit c10cd73

Browse files
committed
Merge branch 'PHP-7.4'
2 parents 0edcd10 + f26b60a commit c10cd73

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Using array unpacking in an array literal that also has string keys (OSS-Fuzz #17965)
3+
--FILE--
4+
<?php
5+
$y = [1, 2, 3];
6+
$z = "bar";
7+
$x = [...$y, "foo" => $z];
8+
var_dump($x);
9+
?>
10+
--EXPECT--
11+
array(4) {
12+
[0]=>
13+
int(1)
14+
[1]=>
15+
int(2)
16+
[2]=>
17+
int(3)
18+
["foo"]=>
19+
string(3) "bar"
20+
}

Zend/zend_compile.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7781,6 +7781,7 @@ void zend_compile_array(znode *result, zend_ast *ast) /* {{{ */
77817781
if (elem_ast->kind == ZEND_AST_UNPACK) {
77827782
zend_compile_expr(&value_node, value_ast);
77837783
if (i == 0) {
7784+
opnum_init = get_next_op_number();
77847785
opline = zend_emit_op_tmp(result, ZEND_INIT_ARRAY, NULL, NULL);
77857786
}
77867787
opline = zend_emit_op(NULL, ZEND_ADD_ARRAY_UNPACK, &value_node, NULL);

0 commit comments

Comments
 (0)