xref: /PHP-8.0/Zend/tests/bug53511.phpt (revision 7aacc705)
1--TEST--
2Bug #53511 (Exceptions are lost in case an exception is thrown in catch operator)
3--FILE--
4<?php
5class Foo {
6    function __destruct() {
7        throw new Exception("ops 1");
8    }
9}
10
11function test() {
12    $e = new Foo();
13    try {
14        throw new Exception("ops 2");
15    } catch (Exception $e) {
16        echo $e->getMessage()."\n";
17    }
18}
19
20test();
21echo "bug\n";
22?>
23--EXPECTF--
24Fatal error: Uncaught Exception: ops 1 in %sbug53511.php:4
25Stack trace:
26#0 %sbug53511.php(12): Foo->__destruct()
27#1 %sbug53511.php(17): test()
28#2 {main}
29  thrown in %sbug53511.php on line 4
30