Skip to content

Commit 817b508

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
2 parents dee977b + 59dfaa3 commit 817b508

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
@@ -2895,8 +2895,10 @@ static int zend_update_type_info(const zend_op_array *op_array,
28952895
tmp = t1;
28962896
if (t1 & MAY_BE_ARRAY) {
28972897
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
2898-
/* SEND_UNPACK may acquire references into the array */
2899-
tmp |= MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
2898+
if (t1 & MAY_BE_ARRAY_OF_ANY) {
2899+
/* SEND_UNPACK may acquire references into the array */
2900+
tmp |= MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
2901+
}
29002902
}
29012903
if (t1 & MAY_BE_OBJECT) {
29022904
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)