xref: /PHP-7.2/Zend/tests/try/bug70228_3.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            } finally {
12                return 42;
13            }
14        } finally {
15            throw new Exception(2);
16        }
17    }
18}
19
20try {
21    var_dump(test());
22} catch (Exception $e) {
23    do {
24        echo $e->getMessage() . "\n";
25        $e = $e->getPrevious();
26    } while ($e);
27}
28?>
29--EXPECT--
302
311
32