com php-src: Fixed bug #75687 (var 8 (TMP) has array key type but not value type): NEWS ext/opcache/Optimizer/zend_inference.c ext/op
cache/tests/bug75687.phpt
| From: | Xinchen Hui | Date: | Sat, 16 Dec 2017 15:59:10 +0000 |
| Subject: | com php-src: Fixed bug #75687 (var 8 (TMP) has array key type but not value type): NEWS ext/opcache/Optimizer/zend_inference.c ext/op cache/tests/bug75687.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-100609@lists.php.net to get a copy of this message | ||
Commit: a20c9bd3fec9b1df83193ae0db18cb04064461e3
Author: Xinchen Hui <laruence@gmail.com> Sat, 16 Dec 2017 23:59:10 +0800
Parents: eb77c2c2a7164622e920befab0aaff6d2edc12a1
Branches: PHP-7.2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a20c9bd3fec9b1df83193ae0db18cb04064461e3
Log:
Fixed bug #75687 (var 8 (TMP) has array key type but not value type)
Bugs:
https://bugs.php.net/75687
Changed paths:
M NEWS
M ext/opcache/Optimizer/zend_inference.c
A ext/opcache/tests/bug75687.phpt
Diff:
diff --git a/NEWS b/NEWS
index e8d8ef7..7dec72c 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,10 @@ PHP NEWS
- Core:
. Fixed bug #75679 (Path 260 character problem). (Anatol)
+- Opcache:
+ . Fixed bug #75687 (var 8 (TMP) has array key type but not value type).
+ (Laruence)
+
- PGSQL:
. Fixed bug #75671 (pg_version() crashes when called on a connection to
cockroach). (magicaltux at gmail dot com)
diff --git a/ext/opcache/Optimizer/zend_inference.c b/ext/opcache/Optimizer/zend_inference.c
index dd49cc1..263df05 100644
--- a/ext/opcache/Optimizer/zend_inference.c
+++ b/ext/opcache/Optimizer/zend_inference.c
@@ -3338,6 +3338,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 0000000..67cf828
--- /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