xref: /PHP-8.0/Zend/tests/exception_008.phpt (revision f8d79582)
1--TEST--
2Exception in __destruct while exception is pending
3--FILE--
4<?php
5
6class TestFirst
7{
8    function __destruct() {
9        throw new Exception("First");
10    }
11}
12
13class TestSecond
14{
15    function __destruct() {
16        throw new Exception("Second");
17    }
18}
19
20$ar = array(new TestFirst, new TestSecond);
21
22unset($ar);
23
24?>
25===DONE===
26--EXPECTF--
27Fatal error: Uncaught Exception: First in %sexception_008.php:%d
28Stack trace:
29#0 %sexception_008.php(%d): TestFirst->__destruct()
30#1 {main}
31
32Next Exception: Second in %sexception_008.php:%d
33Stack trace:
34#0 %sexception_008.php(%d): TestSecond->__destruct()
35#1 {main}
36  thrown in %sexception_008.php on line %d
37