xref: /PHP-8.0/Zend/tests/try/try_finally_015.phpt (revision a555cc0b)
1--TEST--
2Ignoring return inside loop using finally
3--FILE--
4<?php
5
6function foo() {
7    $array = [1, 2, $n = 3];
8    foreach ($array as $value) {
9        var_dump($value);
10        try {
11            try {
12                foreach ($array as $_) {
13                    return;
14                }
15            } finally {
16                throw new Exception;
17            }
18        } catch (Exception $e) { }
19    }
20}
21
22foo();
23?>
24--EXPECT--
25int(1)
26int(2)
27int(3)
28