Skip to content

Commit 6b9af4f

Browse files
committed
Merge branch 'PHP-7.4' of git.php.net:php-src into PHP-7.4
* 'PHP-7.4' of git.php.net:php-src: Remove DateTime class registration test Fixed bug #78973 Fixed bug #78961 (erroneous optimization of re-assigned $GLOBALS)
2 parents c85a877 + 8e12f04 commit 6b9af4f

File tree

7 files changed

+43
-208
lines changed

7 files changed

+43
-208
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ PHP NEWS
66
- Core:
77
. Fixed bug #78929 (plus signs in cookie values are converted to spaces).
88
(Alexey Kachalin)
9+
. Fixed bug #78973 (Destructor during CV freeing causes segfault if opline
10+
never saved). (Nikita)
911

1012
- OPcache:
13+
. Fixed bug #78961 (erroneous optimization of re-assigned $GLOBALS). (Dmitry)
1114
. Fixed bug #78950 (Preloading trait method with static variables). (Nikita)
1215
. Fixed bug #78903 (Conflict in RTD key for closures results in crash).
1316
(Nikita)

Zend/tests/bug78973.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Bug #78973: Destructor during CV freeing causes segfault if opline never saved
3+
--FILE--
4+
<?php
5+
6+
function test($x) {
7+
}
8+
test(new class {
9+
public function __destruct() {
10+
debug_print_backtrace();
11+
}
12+
});
13+
14+
?>
15+
--EXPECTF--
16+
#0 class@anonymous->__destruct() called at [%s:4]
17+
#1 test() called at [%s:5]

Zend/zend_vm_def.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2867,6 +2867,7 @@ ZEND_VM_HOT_HELPER(zend_leave_helper, ANY, ANY)
28672867
{
28682868
zend_execute_data *old_execute_data;
28692869
uint32_t call_info = EX_CALL_INFO();
2870+
SAVE_OPLINE();
28702871

28712872
if (EXPECTED((call_info & (ZEND_CALL_CODE|ZEND_CALL_TOP|ZEND_CALL_HAS_SYMBOL_TABLE|ZEND_CALL_FREE_EXTRA_ARGS|ZEND_CALL_ALLOCATED)) == 0)) {
28722873
i_free_compiled_variables(execute_data);

Zend/zend_vm_execute.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,6 +1130,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_leave_helper
11301130
{
11311131
zend_execute_data *old_execute_data;
11321132
uint32_t call_info = EX_CALL_INFO();
1133+
SAVE_OPLINE();
11331134

11341135
if (EXPECTED((call_info & (ZEND_CALL_CODE|ZEND_CALL_TOP|ZEND_CALL_HAS_SYMBOL_TABLE|ZEND_CALL_FREE_EXTRA_ARGS|ZEND_CALL_ALLOCATED)) == 0)) {
11351136
i_free_compiled_variables(execute_data);
@@ -53445,6 +53446,7 @@ ZEND_API void execute_ex(zend_execute_data *ex)
5344553446
{
5344653447
zend_execute_data *old_execute_data;
5344753448
uint32_t call_info = EX_CALL_INFO();
53449+
SAVE_OPLINE();
5344853450

5344953451
if (EXPECTED((call_info & (ZEND_CALL_CODE|ZEND_CALL_TOP|ZEND_CALL_HAS_SYMBOL_TABLE|ZEND_CALL_FREE_EXTRA_ARGS|ZEND_CALL_ALLOCATED)) == 0)) {
5345053452
i_free_compiled_variables(execute_data);

ext/date/tests/DateTime_verify.phpt

Lines changed: 0 additions & 208 deletions
This file was deleted.

ext/opcache/Optimizer/pass1_5.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,8 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
515515
zend_optimizer_collect_constant(ctx, &ZEND_OP1_LITERAL(opline), &ZEND_OP2_LITERAL(opline));
516516
}
517517
break;
518+
#if 0
519+
/* see ext/opcache/tests/bug78961.phpt */
518520
// case ZEND_FETCH_R:
519521
case ZEND_FETCH_W:
520522
// case ZEND_FETCH_RW:
@@ -558,6 +560,7 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx)
558560
MAKE_NOP(opline);
559561
}
560562
break;
563+
#endif
561564

562565
case ZEND_RETURN:
563566
case ZEND_RETURN_BY_REF:

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)