1--TEST--
2Test throwing from fiber
3--FILE--
4<?php
5
6$fiber = new Fiber(function (): void {
7    $fiber = new Fiber(function (int $x, int $y): void {
8        Fiber::suspend($x + $y);
9        throw new Exception('test');
10    });
11
12    $value = $fiber->start(1, 2);
13    var_dump($value);
14    $fiber->resume($value);
15});
16
17$fiber->start();
18
19?>
20--EXPECTF--
21int(3)
22
23Fatal error: Uncaught Exception: test in %sfailing-nested-fiber.php:6
24Stack trace:
25#0 [internal function]: {closure}(1, 2)
26#1 %sfailing-nested-fiber.php(%d): Fiber->resume(3)
27#2 [internal function]: {closure}()
28#3 %sfailing-nested-fiber.php(%d): Fiber->start()
29#4 {main}
30  thrown in %sfailing-nested-fiber.php on line %d
31