xref: /PHP-8.0/Zend/tests/try/try_finally_017.phpt (revision a555cc0b)
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--EXPECT--
38finally1
39catch2
40finally2
41