xref: /ext-fiber/tests/failing-fiber.phpt (revision 068e4ea3)
1--TEST--
2Test throwing from fiber
3--EXTENSIONS--
4fiber
5--FILE--
6<?php
7
8$fiber = new Fiber(function (): void {
9    Fiber::suspend('test');
10    throw new Exception('test');
11});
12
13$value = $fiber->start();
14var_dump($value);
15
16$fiber->resume($value);
17
18?>
19--EXPECTF--
20string(4) "test"
21
22Fatal error: Uncaught Exception: test in %sfailing-fiber.php:%d
23Stack trace:
24#0 [internal function]: {closure}()
25#1 %sfailing-fiber.php(%d): Fiber->resume('test')
26#2 {main}
27  thrown in %sfailing-fiber.php on line %d
28