我有這樣的代碼: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