Exemple #1
0
 /**
  * PHP Error handler
  *
  * @param   int     $severity  the severity code
  * @param   string  $message   the error message
  * @param   string  $filepath  the path to the file throwing the error
  * @param   int     $line      the line number of the error
  * @return  bool    whether to continue with execution
  */
 public static function error_handler($severity, $message, $filepath, $line)
 {
     // don't do anything if error reporting is disabled
     if (error_reporting() !== 0) {
         $fatal = (bool) (!in_array($severity, \Config::get('errors.continue_on', array())));
         if ($fatal) {
             throw new \PhpErrorException($message, $severity, 0, $filepath, $line);
         } else {
             // non-fatal, recover from the error
             $e = new \PhpErrorException($message, $severity, 0, $filepath, $line);
             $e->recover();
         }
     }
     return true;
 }