xref: /PHP-5.5/Zend/tests/bug65784.phpt (revision dde552f2)
1--TEST--
2Fixed Bug #65784 (Segfault with finally)
3--XFAIL--
4This bug is not fixed in 5.5 due to ABI BC
5--FILE--
6<?php
7function foo1() {
8	try {
9		throw new Exception("not catch");
10		return true;
11	} finally {
12		try {
13			throw new Exception("catched");
14		} catch (Exception $e) {
15		}
16	}
17}
18try {
19	$foo = foo1();
20	var_dump($foo);
21} catch (Exception $e) {
22	do {
23		var_dump($e->getMessage());
24	} while ($e = $e->getPrevious());
25}
26
27function foo2() {
28	try  {
29		try {
30			throw new Exception("catched");
31			return true;
32		} finally {
33			try {
34				throw new Exception("catched");
35			} catch (Exception $e) {
36			}
37		}
38	} catch (Exception $e) {
39	}
40}
41
42$foo = foo2();
43var_dump($foo);
44
45function foo3() {
46	try {
47		throw new Exception("not catched");
48		return true;
49	} finally {
50		try {
51			throw new NotExists();
52		} catch (Exception $e) {
53		}
54	}
55}
56
57$bar = foo3();
58--EXPECTF--
59string(9) "not catch"
60NULL
61
62Fatal error: Class 'NotExists' not found in %sbug65784.php on line %d
63