xref: /PHP-5.3/Zend/tests/catch_003.phpt (revision 610c7fbe)
1--TEST--
2Catching an exception in a constructor fired form a static method
3--FILE--
4<?php
5
6class MyObject
7{
8	function fail()
9	{
10		throw new Exception();
11	}
12
13	function __construct()
14	{
15		self::fail();
16		echo __METHOD__ . "() Must not be reached\n";
17	}
18
19	function __destruct()
20	{
21		echo __METHOD__ . "() Must not be called\n";
22	}
23}
24
25try
26{
27	new MyObject();
28}
29catch(Exception $e)
30{
31	echo "Caught\n";
32}
33
34?>
35===DONE===
36--EXPECT--
37Caught
38===DONE===
39