Esempio n. 1
0
 /**
  * Handles a error message.
  *
  * @param int    $errno   The error code to handle
  * @param string $errstr  The error message
  * @param string $errfile The file in which the error occured
  * @param int    $errline The line of the file in which the error occured
  *
  * @throws ErrorException
  */
 public static function handleError($errno, $errstr, $errfile, $errline)
 {
     if (in_array($errno, [E_USER_ERROR, E_ERROR, E_COMPILE_ERROR, E_RECOVERABLE_ERROR, E_PARSE])) {
         throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
     } elseif ((error_reporting() & $errno) == $errno) {
         if (ini_get('display_errors') && (rex::isSetup() || rex::isDebugMode() || ($user = rex_backend_login::createUser()) && $user->isAdmin())) {
             echo '<div><b>' . self::getErrorType($errno) . "</b>: {$errstr} in <b>{$errfile}</b> on line <b>{$errline}</b></div>";
         }
         rex_logger::logError($errno, $errstr, $errfile, $errline);
     }
 }