summaryrefslogtreecommitdiff
path: root/Zend/tests/try/try_finally_023.phpt
blob: e88eddb3b236fd725bb353a4c6c181192a57621c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--TEST--
Loop var dtor throwing exception during return inside try/catch inside finally
--FILE--
<?php

class Dtor {
    public function __destruct() {
        throw new Exception(2);
    }
}

function test() {
    try {
        throw new Exception(1);
    } finally {
        try {
            foreach ([new Dtor] as $v) {
                unset($v);
                return 42;
            }
        } catch (Exception $e) {
        }
    }
}

try {
    test();
} catch (Exception $e) {
    echo $e, "\n";
}

?>
--EXPECTF--
Exception: 1 in %s:%d
Stack trace:
#0 %s(%d): test()
#1 {main}