2002-08-16 00:41:37 +00:00
|
|
|
--TEST--
|
|
|
|
ZE2: set_exception_handler()
|
|
|
|
--SKIPIF--
|
2002-10-29 13:51:44 +00:00
|
|
|
<?php if (version_compare(zend_version(), "2.0.0-dev", "<")) print "skip Zend engine 2 required"; ?>
|
2002-08-16 00:41:37 +00:00
|
|
|
--FILE--
|
|
|
|
<?php
|
2002-10-29 13:51:44 +00:00
|
|
|
class MyException {
|
|
|
|
function MyException($_error) {
|
|
|
|
$this->error = $_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
function getException()
|
|
|
|
{
|
|
|
|
return $this->error;
|
|
|
|
}
|
|
|
|
}
|
2002-07-17 08:49:26 +00:00
|
|
|
|
2002-10-29 13:51:44 +00:00
|
|
|
function ThrowException()
|
|
|
|
{
|
|
|
|
throw new MyException("'This is an exception!'");
|
2002-08-16 00:41:37 +00:00
|
|
|
}
|
|
|
|
|
2002-10-29 13:51:44 +00:00
|
|
|
|
|
|
|
try {
|
|
|
|
} catch (MyException $exception) {
|
|
|
|
print "There shouldn't be an exception: " . $exception->getException();
|
|
|
|
print "\n";
|
2002-08-16 00:41:37 +00:00
|
|
|
}
|
|
|
|
|
2002-10-29 13:51:44 +00:00
|
|
|
try {
|
|
|
|
ThrowException();
|
|
|
|
} catch (MyException $exception) {
|
|
|
|
print "There was an exception: " . $exception->getException();
|
|
|
|
print "\n";
|
|
|
|
}
|
2002-08-16 00:41:37 +00:00
|
|
|
?>
|
|
|
|
--EXPECT--
|
2002-10-29 13:51:44 +00:00
|
|
|
There was an exception: 'This is an exception!'
|