mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix unexpected deprecated dynamic property warning (#9324)
Occurred when exit() with uncaught exception in finally block.
This commit is contained in:
parent
0f29436a2f
commit
7eba683e2c
3 changed files with 25 additions and 2 deletions
13
Zend/tests/throw/exit_in_finally.phpt
Normal file
13
Zend/tests/throw/exit_in_finally.phpt
Normal 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
|
|
@ -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 */
|
/* Chain potential exception from wrapping finally block */
|
||||||
if (Z_OBJ_P(fast_call)) {
|
if (Z_OBJ_P(fast_call)) {
|
||||||
if (ex) {
|
if (ex) {
|
||||||
zend_exception_set_previous(ex, Z_OBJ_P(fast_call));
|
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 {
|
} else {
|
||||||
ex = EG(exception) = Z_OBJ_P(fast_call);
|
ex = EG(exception) = Z_OBJ_P(fast_call);
|
||||||
}
|
}
|
||||||
|
|
7
Zend/zend_vm_execute.h
generated
7
Zend/zend_vm_execute.h
generated
|
@ -3130,7 +3130,12 @@ static zend_never_inline ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL zend_dispatch_try
|
||||||
/* Chain potential exception from wrapping finally block */
|
/* Chain potential exception from wrapping finally block */
|
||||||
if (Z_OBJ_P(fast_call)) {
|
if (Z_OBJ_P(fast_call)) {
|
||||||
if (ex) {
|
if (ex) {
|
||||||
zend_exception_set_previous(ex, Z_OBJ_P(fast_call));
|
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 {
|
} else {
|
||||||
ex = EG(exception) = Z_OBJ_P(fast_call);
|
ex = EG(exception) = Z_OBJ_P(fast_call);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue