xref: /PHP-8.1/Zend/tests/try/bug70228_5.phpt (revision 10f05625)
1--TEST--
2Bug #70228 (memleak if return hidden by throw in finally block)
3--FILE--
4<?php
5function test() {
6    try {
7        return str_repeat("a", 2);
8    } finally {
9        throw new Exception("ops");
10    }
11}
12
13try {
14    test();
15} catch (Exception $e) {
16    echo $e->getMessage(), "\n";
17}
18?>
19--EXPECT--
20ops
21