1--TEST--
2Throw in multiple destroyed fibers after shutdown
3--EXTENSIONS--
4fiber
5--FILE--
6<?php
7
8$fiber = new Fiber(function (): void {
9    $fiber1 = new Fiber(function (): void {
10        try {
11            Fiber::suspend();
12        } finally {
13            throw new Exception('test1');
14        }
15    });
16
17    $fiber1->start();
18
19    $fiber2 = new Fiber(function (): void {
20        try {
21            Fiber::suspend();
22        } finally {
23            throw new Exception('test2');
24        }
25    });
26
27    $fiber2->start();
28
29    Fiber::suspend();
30});
31
32$fiber->start();
33
34echo "done\n";
35
36?>
37--EXPECTF--
38done
39
40Fatal error: Uncaught FiberExit: Fiber destroyed in %sthrow-in-multiple-destroyed-fibers-after-shutdown.php:%d
41Stack trace:
42#0 %sthrow-in-multiple-destroyed-fibers-after-shutdown.php(%d): Fiber::suspend()
43#1 [internal function]: {closure}()
44#2 {main}
45
46Next FiberExit: Fiber destroyed in %sthrow-in-multiple-destroyed-fibers-after-shutdown.php:%d
47Stack trace:
48#0 %sthrow-in-multiple-destroyed-fibers-after-shutdown.php(%d): Fiber::suspend()
49#1 [internal function]: {closure}()
50#2 {main}
51
52Next Exception: test1 in %sthrow-in-multiple-destroyed-fibers-after-shutdown.php:%d
53Stack trace:
54#0 [internal function]: {closure}()
55#1 {main}
56
57Next FiberExit: Fiber destroyed in %sthrow-in-multiple-destroyed-fibers-after-shutdown.php:%d
58Stack trace:
59#0 %sthrow-in-multiple-destroyed-fibers-after-shutdown.php(%d): Fiber::suspend()
60#1 [internal function]: {closure}()
61#2 {main}
62
63Next Exception: test2 in %sthrow-in-multiple-destroyed-fibers-after-shutdown.php:%d
64Stack trace:
65#0 [internal function]: {closure}()
66#1 {main}
67  thrown in %sthrow-in-multiple-destroyed-fibers-after-shutdown.php on line %d
68