php-src/tests/lang/catchable_error_002.phpt

30 lines
493 B
Plaintext
Raw Normal View History

2006-10-10 00:02:34 +08:00
--TEST--
Catchable fatal error [2]
--FILE--
<?php
2020-02-04 05:52:20 +08:00
class Foo {
}
2006-10-10 00:02:34 +08:00
2020-02-04 05:52:20 +08:00
function blah (Foo $a)
{
}
2006-10-10 00:02:34 +08:00
2020-02-04 05:52:20 +08:00
function error()
{
$a = func_get_args();
var_dump($a);
}
2006-10-10 00:02:34 +08:00
2020-02-04 05:52:20 +08:00
set_error_handler('error');
2006-10-10 00:02:34 +08:00
2020-02-04 05:52:20 +08:00
try {
blah (new StdClass);
} catch (Error $ex) {
echo $ex->getMessage(), "\n";
}
echo "ALIVE!\n";
2006-10-10 00:02:34 +08:00
?>
--EXPECTF--
blah(): Argument #1 ($a) must be of type Foo, stdClass given, called in %scatchable_error_002.php on line %d
2006-10-10 00:02:34 +08:00
ALIVE!