1--TEST--
2Fiber throwing from destructor
3--EXTENSIONS--
4fiber
5--FILE--
6<?php
7
8$object = new class() {
9    public function __destruct()
10    {
11        $fiber = new Fiber(static function (): int {
12            Fiber::suspend(1);
13            throw new Exception('test');
14        });
15
16        var_dump($fiber->start());
17        var_dump($fiber->resume());
18    }
19};
20
21?>
22--EXPECTF--
23int(1)
24
25Fatal error: Uncaught Exception: test in %sfiber-throw-in-destruct.php:%d
26Stack trace:
27#0 [internal function]: class@anonymous::{closure}()
28#1 %sfiber-throw-in-destruct.php(%d): Fiber->resume()
29#2 [internal function]: class@anonymous->__destruct()
30#3 {main}
31  thrown in %sfiber-throw-in-destruct.php on line %d
32