summaryrefslogtreecommitdiff
path: root/tests/lang/035.phpt
blob: 0292868d7fc9c8bb7e54b8ca99a53e9b1c18044c (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!'