Fix unexpected deprecated dynamic property warning (#9324)

Occurred when exit() with uncaught exception in finally block.
This commit is contained in:
twosee 2022-08-15 20:54:39 +08:00 committed by GitHub
parent 0f29436a2f
commit 7eba683e2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 2 deletions

View file

@ -0,0 +1,13 @@
--TEST--
Test exit with uncaught exception in finally block
--FILE--
<?php
try {
throw new Exception();
} finally {
echo "Done\n";
exit();
}
?>
--EXPECT--
Done

View file

@ -7876,7 +7876,12 @@ ZEND_VM_HELPER(zend_dispatch_try_catch_finally_helper, ANY, ANY, uint32_t try_ca
/* Chain potential exception from wrapping finally block */
if (Z_OBJ_P(fast_call)) {
if (ex) {
if (zend_is_unwind_exit(ex) || zend_is_graceful_exit(ex)) {
/* discard the previously thrown exception */
OBJ_RELEASE(Z_OBJ_P(fast_call));
} else {
zend_exception_set_previous(ex, Z_OBJ_P(fast_call));
}
} else {
ex = EG(exception) = Z_OBJ_P(fast_call);
}

View file

@ -3130,7 +3130,12 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_dispatch_try
/* Chain potential exception from wrapping finally block */
if (Z_OBJ_P(fast_call)) {
if (ex) {
if (zend_is_unwind_exit(ex) || zend_is_graceful_exit(ex)) {
/* discard the previously thrown exception */
OBJ_RELEASE(Z_OBJ_P(fast_call));
} else {
zend_exception_set_previous(ex, Z_OBJ_P(fast_call));
}
} else {
ex = EG(exception) = Z_OBJ_P(fast_call);
}