com php-src: Fixed bug #74456 (Segmentation error while running a script in CLI mode): NEWS ext/opcache/Optimizer/block_pass.c ext/op cache/tests/bug74456.phpt
[email protected] (Xinchen Hui)
| Newsgroups | php.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit: d6315c2fbb46ea8795d2158e32c32f4111e805c1 Author: Xinchen Hui <[email protected]> Mon, 17 Apr 2017 20:24:39 +0800 Parents: f69c1082498569dcab95706ce1f6b9c2ac07f367 Branches: PHP-7.1 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d6315c2fbb46ea8795d2158e32c32f4111e805c1 Log: 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 Bugs: https://bugs.php.net/74456 Changed paths: M NEWS M ext/opcache/Optimizer/block_pass.c A ext/opcache/tests/bug74456.phpt Diff: diff --git a/NEWS b/NEWS index 05c8246..02d5e0a 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 bf411f4..ee4b551 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 0000000..9c9a286 --- /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)