]> granicus.if.org Git - php/commitdiff
Clarify ZEND_CATCH code
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 26 May 2020 09:33:50 +0000 (11:33 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 26 May 2020 09:34:07 +0000 (11:34 +0200)
UNDEF the opcode result instead of addref'ing the exception.

Zend/zend_vm_def.h
Zend/zend_vm_execute.h

index 9cccd2e2f99eb35d9e734f9a31058d00d0b2c8de..ed160f18da338850465c54e88834e9b319923206 100644 (file)
@@ -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;
index 068e1338a377d6c5ff522543623e58aa7ae2c523..d4077f5605f503b5f6978cc2521b43f8b15f0f12 100644 (file)
@@ -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;