我有这样的代码:ReflectionException无法被捕获?
namespace Some\Different\Name;
try {
$reflect = new ReflectionClass($class);
X: $instance = $reflect->newInstanceArgs($args);
} catch (ReflectionException $e) {
exit($e->getMessage());
}
,我测试它试图使ReflectionException被抛出。它给了我:
Fatal error: Uncaught exception 'ReflectionException' with message 'Class MyClass does not have a constructor, so you cannot pass any constructor arguments' in ... on line X.
我在做什么错? PS:我知道为什么抛出异常,我只想知道它为什么没有被捕获!
真的很奇怪。一个通用的catch(Exception $ e)会捕获它吗? – 2012-02-25 02:32:50
请添加该错误的回溯。 – hakre 2012-02-25 02:40:35
@MikePurcell,它没有。 – Shoe 2012-02-25 02:48:07