summaryrefslogtreecommitdiff
path: root/tests/lang/035.phpt
blob: bc49af99a55288f2a74ce94077ff8de3c77271f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
--TEST--
ZE2: set_exception_handler()
--FILE--
<?php
class MyException extends Exception {
	function __construct($_error) {
		$this->error = $_error;
	}

	function getException()
	{
		return $this->error;
	}
}

function ThrowException()
{
	throw new MyException("'This is an exception!'");
}


try {
} catch (MyException $exception) {
	print "There shouldn't be an exception: " . $exception->getException();
	print "\n";
}

try {
	ThrowException();
} catch (MyException $exception) {
	print "There was an exception: " . $exception->getException();
	print "\n";
}
?>
--EXPECT--
There was an exception: 'This is an exception!'