コード例 #1
0
ファイル: Error.php プロジェクト: betuto92/Pokelio_Framework
 /**
  * Error manager for fatal errors
  * It manages fatal errors 
  * 
  * This function is not invoked by the app. Instead of that, PHP interpreter invokes it
  * each time a fatal error occurs
  */
 public static function PokelioFatalErrorHandler()
 {
     //Get the error handling rules from configuration array
     $errorRules = Pokelio_Global::getConfig('ERROR_HANDLING_RULES', 'Pokelio');
     $error = null;
     $error = error_get_last();
     //Handle error only in case it exists
     if ($error !== NULL) {
         $errno = $error["type"];
         $errfile = $error["file"];
         $errline = $error["line"];
         $errstr = $error["message"];
         //Inform to user
         if ($errorRules->{1}->I && $errorRules->all->I) {
             $text = self::getFatalErrorPage($errno, $errstr, $errfile, $errline);
             if (SESSION_TYPE == 'WEB') {
                 ob_clean();
                 echo "<pre>" . htmlentities($text) . "</pre>";
             } else {
                 echo $text;
             }
         }
         if ($errorRules->{1}->I && $errorRules->all->L) {
             //Write to log file
             Pokelio_Log::write($errno . " " . $errstr . " " . $errfile . " " . $errline, $errno);
         }
         if ($errorRules->{1}->I && $errorRules->all->S) {
             //Stop execution?
             Pokelio_Application::abort();
         }
     }
 }
コード例 #2
0
 public static function abort($msg = null)
 {
     Pokelio_Application::abort($msg);
 }