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