1--TEST--
2Test unfinished fiber with suspend in finally
3--FILE--
4<?php
5
6$fiber = new Fiber(function (): void {
7    try {
8        try {
9            try {
10                echo "fiber\n";
11                echo Fiber::suspend();
12                echo "after await\n";
13            } catch (Throwable $exception) {
14                echo "inner exit exception caught!\n";
15            }
16        } catch (Throwable $exception) {
17            echo "exit exception caught!\n";
18        } finally {
19            echo "inner finally\n";
20            throw new \Exception("finally exception");
21        }
22    } catch (Exception $exception) {
23        echo $exception->getMessage(), "\n";
24    } finally {
25        echo "outer finally\n";
26    }
27
28    try {
29        echo Fiber::suspend();
30    } catch (FiberError $exception) {
31        echo $exception->getMessage(), "\n";
32    }
33});
34
35$fiber->start();
36
37unset($fiber); // Destroy fiber object, executing finally block.
38
39echo "done\n";
40
41?>
42--EXPECT--
43fiber
44inner finally
45finally exception
46outer finally
47Cannot suspend in a force-closed fiber
48done
49