xref: /PHP-5.5/ext/opcache/tests/bug65665.phpt (revision 46f18ccf)
1--TEST--
2Bug #65665 (Exception not properly caught when opcache enabled)
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6--SKIPIF--
7<?php require_once('skipif.inc'); ?>
8--FILE--
9<?php
10function foo() {
11	try
12	{
13		switch (1)
14		{
15		case 0:
16			try
17			{
18
19			}
20			catch (Exception $e)
21			{
22
23			}
24
25			break;
26
27		case 1:
28			try
29			{
30				throw new Exception('aaa');
31			}
32			catch (Exception $e)
33			{
34				echo "correct\n";
35			}
36
37			break;
38		}
39	}
40	catch (Exception $e)
41	{
42		echo "wrong\n";
43	}
44	return;
45}
46
47function foo1() {
48	try
49	{
50		switch (1)
51		{
52		case 0:
53			try
54			{
55
56			}
57			catch (Exception $e)
58			{
59dummy:
60				echo "ect\n";
61			}
62
63			break;
64
65		case 1:
66			try
67			{
68				throw new Exception('aaa');
69			}
70			catch (Exception $e)
71			{
72				echo "corr";
73				goto dummy;
74			}
75			break;
76		}
77	}
78	catch (Exception $e)
79	{
80		echo "wrong\n";
81	}
82	return;
83}
84
85function foo2() {
86	try
87	{
88		switch (1)
89		{
90		case 0:
91			try
92			{
93dummy:
94				throw new Exception('aaa');
95			}
96			catch (Exception $e)
97			{
98				echo "correct\n";
99			}
100
101			break;
102
103		case 1:
104			goto dummy;
105			break;
106		}
107	}
108	catch (Exception $e)
109	{
110		echo "wrong\n";
111	}
112	return;
113}
114foo();foo1();foo2();
115--EXPECT--
116correct
117correct
118correct
119