Re: [PHP-CVS] com php-src: Fixed bug #74456 (Segmentation error while running a script in CLI mode): NEWS ext/opcache/Optimizer/block_pass.c ext/opcache/tests/bug74456.phpt
[email protected] (Xinchen Hui)
| Newsgroups | php.cvs |
|---|---|
| Message-ID | <CABBJUpf2tf1+sakqNjYXX5RNaG4XB-F_OhYH1egZ4O7g13031A@mail.gmail.com> |
Hey: On Mon, Apr 17, 2017 at 8:31 PM, Nikita Popov <[email protected]> wrote: > On Mon, Apr 17, 2017 at 2:24 PM, Xinchen Hui <[email protected]> wrote: > >> 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=d6315c2 >> fbb46ea8795d2158e32c32f4111e805c1 >> >> 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) >> >> >> -- >> PHP CVS Mailing List (http://www.php.net/) >> To unsubscribe, visit: http://www.php.net/unsub.php >> > > I think it would be better to return 0 from zend_optimizer_update_op1_const > instead, so we are sure this is also handled in other places using this > function. > > Sounds better, will do it, thanks > Nikita > -- Xinchen Hui @Laruence http://www.laruence.com/