xref: /PHP-8.0/Zend/tests/bug48409.phpt (revision f8d79582)
1--TEST--
2Bug #48409 (crash when exception is thrown while passing function arguments)
3--FILE--
4<?php
5
6class ABCException extends Exception {}
7
8class BBB
9{
10    public function xyz($d, $x)
11    {
12        if ($x == 34) {
13            throw new ABCException;
14        }
15        return array('foo' => 'xyz');
16    }
17}
18
19class CCC
20{
21    public function process($p)
22    {
23        return $p;
24    }
25}
26
27class AAA
28{
29    public function func()
30    {
31        $b = new BBB;
32        $c = new CCC;
33        $i = 34;
34        $item = array('foo' => 'bar');
35        try {
36            $c->process($b->xyz($item['foo'], $i));
37        }
38        catch(ABCException $e) {
39            $b->xyz($item['foo'], $i);
40        }
41    } // end func();
42}
43
44class Runner
45{
46    public function run($x)
47    {
48        try {
49            $x->func();
50        }
51        catch(ABCException $e) {
52            throw new Exception;
53        }
54    }
55}
56
57try {
58    $runner = new Runner;
59    $runner->run(new AAA);
60}
61catch(Exception $e) {
62    die('Exception thrown');
63}
64
65?>
66--EXPECT--
67Exception thrown
68