Skip to content

Commit d6315c2

Browse files
committed
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
1 parent f69c108 commit d6315c2

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ PHP NEWS
4343
. Fixed bug #74439 (wrong reflection for Locale methods). (villfa)
4444

4545
- Opcache:
46+
. Fixed bug #74456 (Segmentation error while running a script in CLI mode).
47+
(Laruence)
4648
. Fixed bug #74431 (foreach infinite loop). (Nikita)
4749
. Fixed bug #74442 (Opcached version produces a nested array). (Nikita)
4850

ext/opcache/Optimizer/block_pass.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
165165
COPY_NODE(opline->op1, src->op1);
166166
VAR_SOURCE(op1) = NULL;
167167
MAKE_NOP(src);
168-
} else {
168+
} else if (opline->opcode != ZEND_FETCH_LIST && opline->opcode != ZEND_CASE) {
169169
zval c = ZEND_OP1_LITERAL(src);
170170
zval_copy_ctor(&c);
171171
if (zend_optimizer_update_op1_const(op_array, opline, &c)) {

ext/opcache/tests/bug74456.phpt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
Bug #74456 (Segmentation error while running a script in CLI mode)
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.optimization_level=-1
7+
--SKIPIF--
8+
<?php require_once('skipif.inc'); ?>
9+
--FILE--
10+
<?php
11+
12+
13+
function small_numbers() {
14+
return [0,1,2];
15+
}
16+
17+
list ($zero, $one, $two) = small_numbers();
18+
19+
var_dump($zero, $one, $two);
20+
?>
21+
--EXPECT--
22+
int(0)
23+
int(1)
24+
int(2)

0 commit comments

Comments
 (0)