xref: /PHP-7.1/Zend/tests/bug26698.phpt (revision 610c7fbe)
1--TEST--
2Bug #26698 (Thrown exceptions while evaluting argument to pass as parameter crash PHP)
3--FILE--
4<?php
5
6ini_set("report_memleaks", 0);  // the exception thrown in this test results in a memory leak, which is fine
7
8class Object
9{
10	function getNone()
11	{
12		throw new Exception('NONE');
13	}
14}
15
16class Proxy
17{
18	function three($a, $b, $c)
19	{
20	}
21
22	function callOne()
23	{
24		try
25		{
26			$res = new Object();
27			$this->three($res->getNone());
28		}
29		catch(Exception $e)
30		{
31			echo 'Caught: '.$e->getMessage()."\n";
32		}
33	}
34
35	function callTwo()
36	{
37		try
38		{
39			$res = new Object();
40			$this->three(1, $res->getNone());
41		}
42		catch(Exception $e)
43		{
44			echo 'Caught: '.$e->getMessage()."\n";
45		}
46	}
47
48	function callThree()
49	{
50		try
51		{
52			$res = new Object();
53			$this->three(1, 2, $res->getNone());
54		}
55		catch(Exception $e)
56		{
57			echo 'Caught: '.$e->getMessage()."\n";
58		}
59	}
60}
61
62$p = new Proxy();
63
64$p->callOne();
65$p->callTwo();
66$p->callThree();
67?>
68===DONE===
69--EXPECT--
70Caught: NONE
71Caught: NONE
72Caught: NONE
73===DONE===
74