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