Skip to content

Commit 98527d7

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Fixed bug #78973
2 parents 546392b + 11b041d commit 98527d7

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

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
@@ -2738,6 +2738,7 @@ ZEND_VM_HOT_HELPER(zend_leave_helper, ANY, ANY)
27382738
{
27392739
zend_execute_data *old_execute_data;
27402740
uint32_t call_info = EX_CALL_INFO();
2741+
SAVE_OPLINE();
27412742

27422743
if (EXPECTED((call_info & (ZEND_CALL_CODE|ZEND_CALL_TOP|ZEND_CALL_HAS_SYMBOL_TABLE|ZEND_CALL_FREE_EXTRA_ARGS|ZEND_CALL_ALLOCATED)) == 0)) {
27432744
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
@@ -1084,6 +1084,7 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_leave_helper
10841084
{
10851085
zend_execute_data *old_execute_data;
10861086
uint32_t call_info = EX_CALL_INFO();
1087+
SAVE_OPLINE();
10871088

10881089
if (EXPECTED((call_info & (ZEND_CALL_CODE|ZEND_CALL_TOP|ZEND_CALL_HAS_SYMBOL_TABLE|ZEND_CALL_FREE_EXTRA_ARGS|ZEND_CALL_ALLOCATED)) == 0)) {
10891090
i_free_compiled_variables(execute_data);
@@ -51458,6 +51459,7 @@ ZEND_API void execute_ex(zend_execute_data *ex)
5145851459
{
5145951460
zend_execute_data *old_execute_data;
5146051461
uint32_t call_info = EX_CALL_INFO();
51462+
SAVE_OPLINE();
5146151463

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

0 commit comments

Comments
 (0)