summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2017-04-17 20:24:39 +0800
committerXinchen Hui <laruence@gmail.com>2017-04-17 20:24:39 +0800
commitd6315c2fbb46ea8795d2158e32c32f4111e805c1 (patch)
treea71718e2d6f1afdcfa0f9d9d70b2766d2658b891
parentf69c1082498569dcab95706ce1f6b9c2ac07f367 (diff)
downloadphp-git-d6315c2fbb46ea8795d2158e32c32f4111e805c1.tar.gz
Fixed bug #74456 (Segmentation error while running a script in CLI mode)
Instead of make update_op1_by_const supports FETCH_LIST(CASE), I think disable it is more safe for 7.1
-rw-r--r--NEWS2
-rw-r--r--ext/opcache/Optimizer/block_pass.c2
-rw-r--r--ext/opcache/tests/bug74456.phpt24
3 files changed, 27 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 05c8246e96..02d5e0a734 100644
--- a/NEWS
+++ b/NEWS
@@ -43,6 +43,8 @@ PHP NEWS
. Fixed bug #74439 (wrong reflection for Locale methods). (villfa)
- Opcache:
+ . Fixed bug #74456 (Segmentation error while running a script in CLI mode).
+ (Laruence)
. Fixed bug #74431 (foreach infinite loop). (Nikita)
. Fixed bug #74442 (Opcached version produces a nested array). (Nikita)
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index bf411f4e77..ee4b5516a9 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -165,7 +165,7 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
COPY_NODE(opline->op1, src->op1);
VAR_SOURCE(op1) = NULL;
MAKE_NOP(src);
- } else {
+ } else if (opline->opcode != ZEND_FETCH_LIST && opline->opcode != ZEND_CASE) {
zval c = ZEND_OP1_LITERAL(src);
zval_copy_ctor(&c);
if (zend_optimizer_update_op1_const(op_array, opline, &c)) {
diff --git a/ext/opcache/tests/bug74456.phpt b/ext/opcache/tests/bug74456.phpt
new file mode 100644
index 0000000000..9c9a286e2f
--- /dev/null
+++ b/ext/opcache/tests/bug74456.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Bug #74456 (Segmentation error while running a script in CLI mode)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.optimization_level=-1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+
+function small_numbers() {
+ return [0,1,2];
+}
+
+list ($zero, $one, $two) = small_numbers();
+
+var_dump($zero, $one, $two);
+?>
+--EXPECT--
+int(0)
+int(1)
+int(2)