mirror of
https://github.com/php/php-src.git
synced 2024-12-02 22:34:55 +08:00
4a08ca1294
I decided to null out EG(exception) early here, which means only the exception from the dtor / ref assign is preserved, and the previous exception is not chained in. This is more robust, and I don't think this situation is common enough to be bothered about the precise behavior.
29 lines
541 B
PHP
29 lines
541 B
PHP
--TEST--
|
|
Bug #53511 (Exceptions are lost in case an exception is thrown in catch operator)
|
|
--FILE--
|
|
<?php
|
|
class Foo {
|
|
function __destruct() {
|
|
throw new Exception("ops 1");
|
|
}
|
|
}
|
|
|
|
function test() {
|
|
$e = new Foo();
|
|
try {
|
|
throw new Exception("ops 2");
|
|
} catch (Exception $e) {
|
|
echo $e->getMessage()."\n";
|
|
}
|
|
}
|
|
|
|
test();
|
|
echo "bug\n";
|
|
--EXPECTF--
|
|
Fatal error: Uncaught Exception: ops 1 in %sbug53511.php:4
|
|
Stack trace:
|
|
#0 %sbug53511.php(12): Foo->__destruct()
|
|
#1 %sbug53511.php(17): test()
|
|
#2 {main}
|
|
thrown in %sbug53511.php on line 4
|