summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2017-07-26 12:07:46 +0800
committerXinchen Hui <laruence@gmail.com>2017-07-26 12:07:46 +0800
commit5910cc071c1113981fd369a8d12301776279d6bb (patch)
tree545aae144e13ac37980d990db9db1865e063b862 /ext
parent36865b3db054c8d2b4e66492887c23e1e5b53537 (diff)
parent53e59e4b34d30198742b338aa9a03e269c8cde3c (diff)
downloadphp-git-5910cc071c1113981fd369a8d12301776279d6bb.tar.gz
Merge branch 'PHP-7.2'
* PHP-7.2: Update NEWS Fixed bug #74980 (Narrowing occurred during type inference)
Diffstat (limited to 'ext')
-rw-r--r--ext/opcache/Optimizer/zend_inference.c8
-rw-r--r--ext/opcache/tests/bug74980.phpt30
2 files changed, 35 insertions, 3 deletions
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index c9e782c352..bac076a386 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -3291,9 +3291,11 @@ int zend_infer_types_ex(const zend_op_array *op_array, const zend_script *script
zend_ssa_var_info *ssa_var_info = ssa->var_info;
int ssa_vars_count = ssa->vars_count;
int i, j;
- uint32_t tmp;
+ uint32_t tmp, worklist_len = zend_bitset_len(ssa_vars_count);
- WHILE_WORKLIST(worklist, zend_bitset_len(ssa_vars_count), j) {
+ while (!zend_bitset_empty(worklist, worklist_len)) {
+ j = zend_bitset_first(worklist, worklist_len);
+ zend_bitset_excl(worklist, j);
if (ssa_vars[j].definition_phi) {
zend_ssa_phi *p = ssa_vars[j].definition_phi;
if (p->pi >= 0) {
@@ -3353,7 +3355,7 @@ int zend_infer_types_ex(const zend_op_array *op_array, const zend_script *script
return FAILURE;
}
}
- } WHILE_WORKLIST_END();
+ }
return SUCCESS;
}
diff --git a/ext/opcache/tests/bug74980.phpt b/ext/opcache/tests/bug74980.phpt
new file mode 100644
index 0000000000..40fd3cd537
--- /dev/null
+++ b/ext/opcache/tests/bug74980.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #74980 (Narrowing occurred during type inference)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+class A
+{
+
+ static function foo()
+ {
+ while ($undef) {
+ $arr[][] = NULL;
+ }
+
+ foreach ($arr as $a) {
+ bar($a + []);
+ }
+ }
+
+}
+
+echo "okey";
+?>
+--EXPECT--
+okey