summaryrefslogtreecommitdiff
path: root/Zend/tests/bug69212.phpt
blob: 418753c3d60eac3dfddb1cd5c843ad6275a0e6df (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
38
39
40
41
42
43
--TEST--
Bug #69212: Leaking VIA_HANDLER func when exception thrown in __call/... arg passing
--FILE--
<?php

class Test {
    public static function __callStatic($method, $args) {}
    public function __call($method, $args) {}
}

function do_throw() { throw new Exception; }

try {
    Test::foo(do_throw());
} catch (Exception $e) {
    echo "Caught!\n";
}
try {
    (new Test)->bar(do_throw());
} catch (Exception $e) {
    echo "Caught!\n";
}

try {
    $f = function () {};
    $f->__invoke(do_throw());
} catch (Exception $e) {
    echo "Caught!\n";
}

try {
    $t = new Test;
    $f->__invoke($t->bar(Test::foo(do_throw())));
} catch (Exception $e) {
    echo "Caught!\n";
}

?>
--EXPECT--
Caught!
Caught!
Caught!
Caught!