Toolbox::userErrorHandlerNormal PHP Méthode

userErrorHandlerNormal() static public méthode

Specific error handler in Normal mode
static public userErrorHandlerNormal ( $errno, $errmsg, $filename, $linenum, $vars )
$errno integer level of the error raised.
$errmsg string error message.
$filename string filename that the error was raised in.
$linenum integer line number the error was raised at.
$vars array that points to the active symbol table at the point the error occurred.
    static function userErrorHandlerNormal($errno, $errmsg, $filename, $linenum, $vars)
    {
        // Date et heure de l'erreur
        $errortype = array(E_ERROR => 'Error', E_WARNING => 'Warning', E_PARSE => 'Parsing Error', E_NOTICE => 'Notice', E_CORE_ERROR => 'Core Error', E_CORE_WARNING => 'Core Warning', E_COMPILE_ERROR => 'Compile Error', E_COMPILE_WARNING => 'Compile Warning', E_USER_ERROR => 'User Error', E_USER_WARNING => 'User Warning', E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error', E_DEPRECATED => 'Deprecated function', E_USER_DEPRECATED => 'User deprecated function');
        // Les niveaux qui seront enregistrés
        $user_errors = array(E_USER_ERROR, E_USER_NOTICE, E_USER_WARNING);
        $err = '  *** PHP ' . $errortype[$errno] . "({$errno}): {$errmsg}\n";
        if (in_array($errno, $user_errors) && function_exists('wddx_serialize_value')) {
            $err .= "Variables:" . wddx_serialize_value($vars, "Variables") . "\n";
        }
        $skip = array('Toolbox::backtrace()');
        if (isset($_SESSION['glpi_use_mode']) && $_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
            $hide = "Toolbox::userErrorHandlerDebug()";
            $skip[] = "Toolbox::userErrorHandlerNormal()";
        } else {
            $hide = "Toolbox::userErrorHandlerNormal()";
        }
        $err .= self::backtrace(false, $hide, $skip);
        // Save error
        self::logInFile("php-errors", $err);
        // For unit test
        if (class_exists('GlpitestPHPerror')) {
            if (in_array($errno, [E_ERROR, E_USER_ERROR])) {
                throw new GlpitestPHPerror($err);
            }
            /* for tuture usage
               if (in_array($errno, [E_STRICT, E_WARNING, E_CORE_WARNING, E_USER_WARNING, E_DEPRECATED, E_USER_DEPRECATED])) {
                   throw new GlpitestPHPwarning($err);
               }
               if (in_array($errno, [E_NOTICE, E_USER_NOTICE])) {
                  throw new GlpitestPHPnotice($err);
               }
               */
        }
        return $errortype[$errno];
    }