xref: /PHP-7.4/Zend/tests/try/try_finally_017.phpt (revision 74380105)
1--TEST--
2Exception during break 2 with multiple try/catch
3--FILE--
4<?php
5
6class A {
7    public $a = 1;
8    public $b = 2;
9
10    public function __destruct() {
11        throw new Exception;
12    }
13}
14
15function foo() {
16    foreach ([0] as $_) {
17        try {
18            foreach (new A as $value) {
19                try {
20                    break 2;
21                } catch (Exception $e) {
22                    echo "catch1\n";
23                } finally {
24                    echo "finally1\n";
25                }
26            }
27        } catch (Exception $e) {
28            echo "catch2\n";
29        } finally {
30            echo "finally2\n";
31        }
32    }
33}
34
35foo();
36?>
37===DONE===
38--EXPECT--
39finally1
40catch2
41finally2
42===DONE===
43