summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@php.net>2015-08-11 21:01:56 +0800
committerXinchen Hui <laruence@php.net>2015-08-11 21:01:56 +0800
commit79cd9a18b505e8d77d16abe6ef146d4b4ff02ed9 (patch)
treea2fa0ae52a66924ea5a5fba409f645441be7edc4
parent42ef2b500be2d9d3d8ebf77f8c701c39c150aa39 (diff)
downloadphp-git-79cd9a18b505e8d77d16abe6ef146d4b4ff02ed9.tar.gz
Fixed bug #70237 (Empty while and do-while segmentation fault with opcode on CLI enabled).
-rw-r--r--NEWS4
-rw-r--r--ext/opcache/Optimizer/block_pass.c4
-rw-r--r--ext/opcache/tests/bug70237.phpt20
3 files changed, 28 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 3f339fc5cd..2a16be2ce7 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,10 @@ PHP NEWS
. Fixed bug #66606 (Sets HTTP_CONTENT_TYPE but not CONTENT_TYPE).
(wusuopu, cmb)
+- Opcache:
+ . Fixed bug #70237 (Empty while and do-while segmentation fault with opcode
+ on CLI enabled). (Dmitry, Laruence)
+
- Standard:
. Fixed bug #70052 (getimagesize() fails for very large and very small WBMP).
(cmb)
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index 8d33105866..c146d0cc8c 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -367,6 +367,10 @@ static inline void del_source(zend_code_block *from, zend_code_block *to)
return;
}
+ if (from == to) {
+ return;
+ }
+
while (*cs) {
if ((*cs)->from == from) {
DEL_SOURCE(cs);
diff --git a/ext/opcache/tests/bug70237.phpt b/ext/opcache/tests/bug70237.phpt
new file mode 100644
index 0000000000..6bd0318f0b
--- /dev/null
+++ b/ext/opcache/tests/bug70237.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #70237 (Empty while and do-while segmentation fault with opcode on CLI enabled)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+
+function neverUsed() {
+ $bool = false;
+ while ($bool) { };
+ //do { } while ($bool);
+}
+?>
+okey
+--EXPECT--
+okey