com php-src: Fixed bug #74623: NEWS ext/opcache/Optimizer/zend _inference.c ext/opcache/tests/bug74623.phpt
| From: | Nikita Popov | Date: | Fri, 23 Jun 2017 15:32:45 +0000 |
| Subject: | com php-src: Fixed bug #74623: NEWS ext/opcache/Optimizer/zend _inference.c ext/opcache/tests/bug74623.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-98186@lists.php.net to get a copy of this message | ||
Commit: 5b5a92b8b6d96b8fbd8557645801ae99310cab2b
Author: Nikita Popov <nikita.ppv@gmail.com> Fri, 23 Jun 2017 17:32:45 +0200
Parents: 4948da178a1e2e0da4bab76fb4b0ff1948ec8d99
Branches: PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5b5a92b8b6d96b8fbd8557645801ae99310cab2b
Log:
Fixed bug #74623
Bugs:
https://bugs.php.net/74623
Changed paths:
M NEWS
M ext/opcache/Optimizer/zend_inference.c
A ext/opcache/tests/bug74623.phpt
Diff:
diff --git a/NEWS b/NEWS
index eb0da99..cfc773f 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,10 @@ PHP NEWS
(jhdxr)
. Fixed bug #74761 (Unary operator expected error on some systems). (petk)
+- Opcache:
+ . Fixed bug #74623 (Infinite loop in type inference when using HTMLPurifier).
+ (nikic)
+
- SPL:
. Fixed bug #73471 (PHP freezes with AppendIterator). (jhdxr)
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index d6a4c27..a1a6c7b 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -3109,7 +3109,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
opline->opcode == ZEND_FETCH_OBJ_RW ||
opline->opcode == ZEND_FETCH_OBJ_FUNC_ARG) {
if (opline->opcode != ZEND_FETCH_DIM_FUNC_ARG) {
- if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_NULL)) {
+ if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
tmp &= ~(MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE);
tmp |= MAY_BE_OBJECT | MAY_BE_RC1 | MAY_BE_RCN;
}
diff --git a/ext/opcache/tests/bug74623.phpt b/ext/opcache/tests/bug74623.phpt
new file mode 100644
index 0000000..4cd0b26
--- /dev/null
+++ b/ext/opcache/tests/bug74623.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #74623: Infinite loop in type inference when using HTMLPurifier
+--FILE--
+<?php
+
+function crash($arr) {
+ $current_item = false;
+
+ foreach($arr as $item) {
+ if($item->name === 'string') {
+ $current_item = $item;
+ } else {
+ $current_item->a[] = '';
+ }
+ }
+
+}
+
+?>
+===DONE===
+--EXPECT--
+===DONE===