xref: /PHP-8.1/Zend/tests/try/try_finally_016.phpt (revision a555cc0b)
1--TEST--
2Exception during break 2
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        foreach (new A as $value) {
18            try {
19                break 2;
20            } catch (Exception $e) {
21                echo "catch\n";
22            } finally {
23                echo "finally\n";
24            }
25        }
26    }
27}
28
29try {
30    foo();
31} catch (Exception $e) {
32    echo "outer catch\n";
33}
34?>
35--EXPECT--
36finally
37outer catch
38