]> granicus.if.org Git - php/commitdiff
Fixed bug #74456 (Segmentation error while running a script in CLI mode)
authorXinchen Hui <laruence@gmail.com>
Mon, 17 Apr 2017 12:24:39 +0000 (20:24 +0800)
committerXinchen Hui <laruence@gmail.com>
Mon, 17 Apr 2017 12:24:39 +0000 (20:24 +0800)
Instead of make update_op1_by_const supports FETCH_LIST(CASE), I think
disable it is more safe for 7.1

NEWS
ext/opcache/Optimizer/block_pass.c
ext/opcache/tests/bug74456.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 05c8246e969ba5d3cabf596b7515dd3499c9cd5f..02d5e0a734fd0fbf3573f982c735569170272841 100644 (file)
--- 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)
 
index bf411f4e77b4f3e0f34174808e32eadd2237d04c..ee4b5516a9816406928ddefe702f914c2f891bc9 100644 (file)
@@ -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 (file)
index 0000000..9c9a286
--- /dev/null
@@ -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)