1--TEST--
2Test unfinished fiber with suspend in finally
3--FILE--
4<?php
5
6$fiber = new Fiber(function (): object {
7    try {
8        try {
9            echo "fiber\n";
10            return new \stdClass;
11        } finally {
12            echo "inner finally\n";
13            Fiber::suspend();
14            echo "after await\n";
15        }
16    } catch (Throwable $exception) {
17        echo "exit exception caught!\n";
18    } finally {
19        echo "outer finally\n";
20    }
21
22    echo "end of fiber should not be reached\n";
23});
24
25$fiber->start();
26
27unset($fiber); // Destroy fiber object, executing finally block.
28
29echo "done\n";
30
31?>
32--EXPECT--
33fiber
34inner finally
35outer finally
36done
37