com php-src: Fixed bug #74980 (Narrowing occurred during type inference): NEWS ext/opcache/Optimizer/zend_inference.c ext/opcache/t ests/bug74980.phpt
| From: | Xinchen Hui | Date: | Wed, 26 Jul 2017 04:06:33 +0000 |
| Subject: | com php-src: Fixed bug #74980 (Narrowing occurred during type inference): NEWS ext/opcache/Optimizer/zend_inference.c ext/opcache/t ests/bug74980.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-98804@lists.php.net to get a copy of this message | ||
Commit: 3df47c12f77a71f90778ec42e6892c828e702fb2
Author: Xinchen Hui <laruence@gmail.com> Wed, 26 Jul 2017 12:06:33 +0800
Parents: 238f837cbce468dd0b601bf0f0e54d6e7fb4b40b
Branches: PHP-7.1 PHP-7.2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3df47c12f77a71f90778ec42e6892c828e702fb2
Log:
Fixed bug #74980 (Narrowing occurred during type inference)
Bugs:
https://bugs.php.net/74980
Changed paths:
M NEWS
M ext/opcache/Optimizer/zend_inference.c
A ext/opcache/tests/bug74980.phpt
Diff:
diff --git a/NEWS b/NEWS
index 3e32ae0..f3ad8e7 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 a1a6c7b..508ba6c 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 0000000..40fd3cd
--- /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