1--TEST--
2Fiber interaction with custom fiber implementation 3
3--EXTENSIONS--
4zend_test
5--FILE--
6<?php
7$fiber = new Fiber(function (): int {
8    $test = new _ZendTestFiber(function (): void {
9        $value = Fiber::suspend(1);
10        var_dump($value); // int(2)
11        Fiber::suspend(3);
12    });
13    var_dump($test->start()); // NULL
14    echo "unreachable\n"; // Test fiber throws.
15    return 1;
16});
17$value = $fiber->start();
18var_dump($value); // int(1)
19$value = $fiber->resume(2 * $value);
20var_dump($value); // int(3)
21$value = $fiber->throw(new Exception('test'));
22
23?>
24--EXPECTF--
25int(1)
26int(2)
27int(3)
28
29Fatal error: Uncaught Exception: test in %sfiber_test_03.php:%d
30Stack trace:
31#0 {main}
32  thrown in %sfiber_test_03.php on line %d
33