1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
--TEST-- Testing indirect method call and exceptions --FILE-- <?php class foo { public function __construct() { throw new Exception('foobar'); } } try { $X = (new foo)->Inexistent(3); } catch (Exception $e) { var_dump($e->getMessage()); // foobar } ?> --EXPECT-- string(6) "foobar"