xref: /PHP-7.4/Zend/tests/try/bug70228_4.phpt (revision 2ae21abd)
1--TEST--
2Bug #70228 (memleak if return in finally block)
3--FILE--
4<?php
5function test() {
6    try {
7        throw new Exception(1);
8    } finally {
9        try {
10            try {
11                try {
12                } finally {
13                    return 42;
14                }
15            } finally {
16                throw new Exception(3);
17            }
18        } catch (Exception $e) {}
19    }
20}
21
22try {
23    var_dump(test());
24} catch (Exception $e) {
25    do {
26        echo $e->getMessage() . "\n";
27        $e = $e->getPrevious();
28    } while ($e);
29}
30?>
31--EXPECT--
321
33