From: Nikita Popov Date: Tue, 26 May 2020 09:33:50 +0000 (+0200) Subject: Clarify ZEND_CATCH code X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=81c824f41f5e4d0b3720439836302ad1832cdcc7;p=php Clarify ZEND_CATCH code UNDEF the opcode result instead of addref'ing the exception. --- diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 9cccd2e2f9..ed160f18da 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -4493,7 +4493,7 @@ ZEND_VM_HANDLER(107, ZEND_CATCH, CONST, JMP_ADDR, LAST_CATCH|CACHE_SLOT) zval_ptr_dtor(ex); ZVAL_OBJ(ex, EG(exception)); if (UNEXPECTED(EG(exception) != exception)) { - GC_ADDREF(EG(exception)); + ZVAL_UNDEF(ex); HANDLE_EXCEPTION(); } else { EG(exception) = NULL; diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 068e1338a3..d4077f5605 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -3709,7 +3709,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CATCH_SPEC_CONST_HANDLER(ZEND_ zval_ptr_dtor(ex); ZVAL_OBJ(ex, EG(exception)); if (UNEXPECTED(EG(exception) != exception)) { - GC_ADDREF(EG(exception)); + ZVAL_UNDEF(ex); HANDLE_EXCEPTION(); } else { EG(exception) = NULL;