From 3df47c12f77a71f90778ec42e6892c828e702fb2 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Wed, 26 Jul 2017 12:06:33 +0800 Subject: [PATCH] Fixed bug #74980 (Narrowing occurred during type inference) --- NEWS | 3 +++ ext/opcache/Optimizer/zend_inference.c | 8 ++++--- ext/opcache/tests/bug74980.phpt | 30 ++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 ext/opcache/tests/bug74980.phpt diff --git a/NEWS b/NEWS index 3e32ae06e1..f3ad8e71b5 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,9 @@ PHP NEWS . Fixed bug #74968 (PHP crashes when calling mysqli_result::fetch_object with an abstract class). (Anatol) +- Opcache: + . Fixed bug #74980 (Narrowing occurred during type inference). (Laruence) + - Session: . Fixed bug #74892 (Url Rewriting (trans_sid) not working on urls that start with "#"). (Andrew Nester) diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c index a1a6c7b611..508ba6c3a1 100644 --- a/ext/opcache/Optimizer/zend_inference.c +++ b/ext/opcache/Optimizer/zend_inference.c @@ -3279,9 +3279,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) { @@ -3340,7 +3342,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-- + +--FILE-- + +--EXPECT-- +okey -- 2.50.1