xref: /PHP-8.0/Zend/tests/bug29368_2.phpt (revision f8d79582)
1--TEST--
2Bug #29368.2 (The destructor is called when an exception is thrown from the constructor).
3--FILE--
4<?php
5class Bomb {
6    function foo() {
7    }
8    function __destruct() {
9        throw new Exception("bomb!");
10    }
11}
12try {
13    $x = new ReflectionMethod(new Bomb(), "foo");
14} catch (Throwable $e) {
15    echo $e->getMessage() . "\n";
16}
17echo "ok\n";
18?>
19--EXPECT--
20bomb!
21ok
22