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