summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-05-28 16:41:17 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-05-28 16:41:17 +0200
commit071b389bc6da9c6dc33e798806a0da63fc1cedf6 (patch)
tree00f6da9296e307cfdcf1c31dd490ebc69f19314e /ext
parentf19dd674e012639f8511ff2e531f24e74ef701ac (diff)
parent817b50826ef49d7a3c55abd57eb7273dc31583c8 (diff)
downloadphp-git-071b389bc6da9c6dc33e798806a0da63fc1cedf6.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
Diffstat (limited to 'ext')
-rw-r--r--ext/opcache/Optimizer/zend_inference.c6
-rw-r--r--ext/opcache/tests/send_unpack_empty_array.phpt24
2 files changed, 28 insertions, 2 deletions
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index 866cfd06bb..0fbeb39a44 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -3091,8 +3091,10 @@ static int zend_update_type_info(const zend_op_array *op_array,
tmp = t1;
if (t1 & MAY_BE_ARRAY) {
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
- /* SEND_UNPACK may acquire references into the array */
- tmp |= MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
+ if (t1 & MAY_BE_ARRAY_OF_ANY) {
+ /* SEND_UNPACK may acquire references into the array */
+ tmp |= MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
+ }
}
if (t1 & MAY_BE_OBJECT) {
tmp |= MAY_BE_RC1 | MAY_BE_RCN;
diff --git a/ext/opcache/tests/send_unpack_empty_array.phpt b/ext/opcache/tests/send_unpack_empty_array.phpt
new file mode 100644
index 0000000000..4059ad40f1
--- /dev/null
+++ b/ext/opcache/tests/send_unpack_empty_array.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Type inference of SEND_UNPACK with empty array
+--FILE--
+<?php
+function test() {
+ $array = [1, 2, 3];
+ $values = [];
+ var_dump(array_push($array, 4, ...$values));
+ var_dump($array);
+}
+test();
+?>
+--EXPECT--
+int(4)
+array(4) {
+ [0]=>
+ int(1)
+ [1]=>
+ int(2)
+ [2]=>
+ int(3)
+ [3]=>
+ int(4)
+}