code = $code; $this->file = $file; $this->line = $line; } /** * PHP error handler. * * @throws Kohana_PHP_Exception * @return void */ public static function error_handler($code, $error, $file, $line, $context = NULL) { // Respect error_reporting settings if (error_reporting() & $code) { // Throw an exception throw new Kohana_PHP_Exception($code, $error, $file, $line, $context); } } /** * Catches errors that are not caught by the error handler, such as E_PARSE. * * @uses Kohana_Exception::handle() * @return void */ public static function shutdown_handler() { if (Kohana_PHP_Exception::$enabled AND $error = error_get_last() AND (error_reporting() & $error['type'])) { // Fake an exception for nice debugging Kohana_Exception::handle(new Kohana_PHP_Exception($error['type'], $error['message'], $error['file'], $error['line'])); } } } // End Kohana PHP Exception