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