xref: /PHP-8.0/Zend/tests/try/try_finally_027.phpt (revision 2ae21abd)
1--TEST--
2Return in try with throw in finally, inside other finally
3--FILE--
4<?php
5
6function test() {
7    try {
8        throw new Exception(1);
9    } finally {
10        try {
11            return 42;
12        } finally {
13            throw new Exception(2);
14        }
15    }
16}
17
18try {
19    test();
20} catch (Exception $e) {
21    echo $e, "\n";
22}
23
24?>
25--EXPECTF--
26Exception: 1 in %s:%d
27Stack trace:
28#0 %s(%d): test()
29#1 {main}
30
31Next Exception: 2 in %s:%d
32Stack trace:
33#0 %s(%d): test()
34#1 {main}
35