xref: /PHP-7.4/tests/lang/035.phpt (revision 782352c5)
1--TEST--
2ZE2: set_exception_handler()
3--FILE--
4<?php
5class MyException extends Exception {
6	function __construct($_error) {
7		$this->error = $_error;
8	}
9
10	function getException()
11	{
12		return $this->error;
13	}
14}
15
16function ThrowException()
17{
18	throw new MyException("'This is an exception!'");
19}
20
21
22try {
23} catch (MyException $exception) {
24	print "There shouldn't be an exception: " . $exception->getException();
25	print "\n";
26}
27
28try {
29	ThrowException();
30} catch (MyException $exception) {
31	print "There was an exception: " . $exception->getException();
32	print "\n";
33}
34?>
35--EXPECT--
36There was an exception: 'This is an exception!'
37