Example #1
0
 /**
  * Catches errors that are not caught by the error handler, such as E_PARSE.
  *
  * @uses    Eight_Exception::handle()
  * @return  void
  */
 public static function shutdown_handler()
 {
     if (!Eight::$instance) {
         // Do not execute when not active
         return;
     }
     if (Eight::$errors and $error = error_get_last() and in_array($error['type'], Eight::$shutdown_errors)) {
         // Clean the output buffer
         ob_get_level() && ob_clean();
         // Fake an exception for nice debugging
         Eight_Exception_PHP::handle(new Eight_Exception_PHP(0, $error['message'], $error['file'], $error['line']));
         // Shutdown now to avoid a "death loop"
         exit(1);
     }
 }