summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2017-12-16 23:59:44 +0800
committerXinchen Hui <laruence@gmail.com>2017-12-16 23:59:44 +0800
commitef9d2cecc66cc474ef54e3b157cded202c3a60aa (patch)
tree0265a57aed9b1828ddf750420037ed30ebf46a88 /ext
parente251d9a6b2534e84248f31a23154c0721b7fba5a (diff)
parenta20c9bd3fec9b1df83193ae0db18cb04064461e3 (diff)
downloadphp-git-ef9d2cecc66cc474ef54e3b157cded202c3a60aa.tar.gz
Merge branch 'PHP-7.2'
* PHP-7.2: Fixed bug #75687 (var 8 (TMP) has array key type but not value type)
Diffstat (limited to 'ext')
-rw-r--r--ext/opcache/Optimizer/zend_inference.c3
-rw-r--r--ext/opcache/tests/bug75687.phpt21
2 files changed, 24 insertions, 0 deletions
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index 02ac1e14d8..8228b361ae 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -3371,6 +3371,9 @@ int zend_infer_types_ex(const zend_op_array *op_array, const zend_script *script
/* Ignore the constraint (either ce instanceof constraint->ce or
* they are unrelated, as far as we can statically determine) */
}
+ } else if ((tmp & MAY_BE_ANY) == 0) {
+ /* FIXME: usage in unreachable block */
+ tmp |= MAY_BE_UNDEF;
}
}
diff --git a/ext/opcache/tests/bug75687.phpt b/ext/opcache/tests/bug75687.phpt
new file mode 100644
index 0000000000..67cf8288a9
--- /dev/null
+++ b/ext/opcache/tests/bug75687.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #75687 (var 8 (TMP) has array key type but not value type)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+function x($y)
+{
+ if (is_array($y)) {
+ $z = is_array($y) ? array() : array($y);
+ }
+}
+?>
+okey
+--EXPECT--
+okey