From: Nikita Popov Date: Thu, 29 Aug 2019 10:34:07 +0000 (+0200) Subject: Merge branch 'PHP-7.3' into PHP-7.4 X-Git-Tag: php-7.4.0RC1~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a12fe30590cab7524a439f25828f636d6093f7ea;p=php Merge branch 'PHP-7.3' into PHP-7.4 --- a12fe30590cab7524a439f25828f636d6093f7ea diff --cc Zend/zend_vm_def.h index c10f9d6169,99b731b11a..aa7a80c95c --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@@ -2909,8 -2430,22 +2909,13 @@@ ZEND_VM_HOT_HELPER(zend_leave_helper, A zend_clean_and_cache_symbol_table(EX(symbol_table)); } EG(current_execute_data) = EX(prev_execute_data); + + /* Free extra args before releasing the closure, + * as that may free the op_array. */ + zend_vm_stack_free_extra_args_ex(call_info, execute_data); + if (UNEXPECTED(call_info & ZEND_CALL_RELEASE_THIS)) { - zend_object *object = Z_OBJ(execute_data->This); -#if 0 - if (UNEXPECTED(EG(exception) != NULL) && (EX(opline)->op1.num & ZEND_CALL_CTOR)) { -#else - if (UNEXPECTED(EG(exception) != NULL) && (call_info & ZEND_CALL_CTOR)) { -#endif - GC_DELREF(object); - zend_object_store_ctor_failed(object); - } - OBJ_RELEASE(object); + OBJ_RELEASE(Z_OBJ(execute_data->This)); } else if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) { OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func))); } diff --cc Zend/zend_vm_execute.h index 6ac1d09e8f,b29f5bddc6..6bc3bb2e94 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@@ -1173,8 -541,22 +1173,13 @@@ static zend_never_inline ZEND_OPCODE_HA zend_clean_and_cache_symbol_table(EX(symbol_table)); } EG(current_execute_data) = EX(prev_execute_data); + + /* Free extra args before releasing the closure, + * as that may free the op_array. */ + zend_vm_stack_free_extra_args_ex(call_info, execute_data); + if (UNEXPECTED(call_info & ZEND_CALL_RELEASE_THIS)) { - zend_object *object = Z_OBJ(execute_data->This); -#if 0 - if (UNEXPECTED(EG(exception) != NULL) && (EX(opline)->op1.num & ZEND_CALL_CTOR)) { -#else - if (UNEXPECTED(EG(exception) != NULL) && (call_info & ZEND_CALL_CTOR)) { -#endif - GC_DELREF(object); - zend_object_store_ctor_failed(object); - } - OBJ_RELEASE(object); + OBJ_RELEASE(Z_OBJ(execute_data->This)); } else if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) { OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func))); } @@@ -53366,8 -55379,22 +53370,13 @@@ zend_leave_helper_SPEC_LABEL zend_clean_and_cache_symbol_table(EX(symbol_table)); } EG(current_execute_data) = EX(prev_execute_data); + + /* Free extra args before releasing the closure, + * as that may free the op_array. */ + zend_vm_stack_free_extra_args_ex(call_info, execute_data); + if (UNEXPECTED(call_info & ZEND_CALL_RELEASE_THIS)) { - zend_object *object = Z_OBJ(execute_data->This); -#if 0 - if (UNEXPECTED(EG(exception) != NULL) && (EX(opline)->op1.num & ZEND_CALL_CTOR)) { -#else - if (UNEXPECTED(EG(exception) != NULL) && (call_info & ZEND_CALL_CTOR)) { -#endif - GC_DELREF(object); - zend_object_store_ctor_failed(object); - } - OBJ_RELEASE(object); + OBJ_RELEASE(Z_OBJ(execute_data->This)); } else if (UNEXPECTED(call_info & ZEND_CALL_CLOSURE)) { OBJ_RELEASE(ZEND_CLOSURE_OBJECT(EX(func))); }