Skip to content

Commit 071b389

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
2 parents f19dd67 + 817b508 commit 071b389

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

ext/opcache/Optimizer/zend_inference.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3091,8 +3091,10 @@ static int zend_update_type_info(const zend_op_array *op_array,
30913091
tmp = t1;
30923092
if (t1 & MAY_BE_ARRAY) {
30933093
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
3094-
/* SEND_UNPACK may acquire references into the array */
3095-
tmp |= MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
3094+
if (t1 & MAY_BE_ARRAY_OF_ANY) {
3095+
/* SEND_UNPACK may acquire references into the array */
3096+
tmp |= MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
3097+
}
30963098
}
30973099
if (t1 & MAY_BE_OBJECT) {
30983100
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
Type inference of SEND_UNPACK with empty array
3+
--FILE--
4+
<?php
5+
function test() {
6+
$array = [1, 2, 3];
7+
$values = [];
8+
var_dump(array_push($array, 4, ...$values));
9+
var_dump($array);
10+
}
11+
test();
12+
?>
13+
--EXPECT--
14+
int(4)
15+
array(4) {
16+
[0]=>
17+
int(1)
18+
[1]=>
19+
int(2)
20+
[2]=>
21+
int(3)
22+
[3]=>
23+
int(4)
24+
}

0 commit comments

Comments
 (0)