Skip to content

Commit 546392b

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fixed bug #78961 (erroneous optimization of re-assigned $GLOBALS)
2 parents 7df8f95 + 6ef7e53 commit 546392b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

ext/opcache/Optimizer/pass1.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,8 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
600600
zend_optimizer_collect_constant(ctx, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline));
601601
}
602602
break;
603+
#if 0
604+
/* see ext/opcache/tests/bug78961.phpt */
603605
// case ZEND_FETCH_R:
604606
case ZEND_FETCH_W:
605607
// case ZEND_FETCH_RW:
@@ -643,6 +645,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
643645
MAKE_NOP(opline);
644646
}
645647
break;
648+
#endif
646649

647650
case ZEND_JMPZ_EX:
648651
case ZEND_JMPNZ_EX:

ext/opcache/tests/bug78961.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Bug #78961 (erroneous optimization of re-assigned $GLOBALS)
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+
$GLOBALS = array();
12+
$GLOBALS['td'] = array();
13+
$GLOBALS['td']['nsno'] = 3;
14+
var_dump($GLOBALS['td']['nsno']);
15+
?>
16+
--EXPECT--
17+
int(3)

0 commit comments

Comments
 (0)