public static function ErrorHandler($errno, $errstr = '', $errfile = '', $errline = '', $errcontext = '') { if (!error_reporting()) { return; } //Error suppressed with @ operator $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 => 'STRICT NOTICE', E_RECOVERABLE_ERROR => 'RECOVERABLE ERROR'); if (count($errcontext)) { $errcontext = count($errcontext) . ' entries'; } if (array_key_exists($errno, $errorType)) { $err = $errorType[$errno]; } else { $err = 'CAUGHT EXCEPTION'; } $message = "{$err}[{$errno}]: {$errstr} in file [{$errfile}] at line [{$errline}] context [{$errcontext}]"; echo $message . "<hr>"; if (rad_dbpdo::connected()) { rad_dblogger::logerr($message); } else { rad_dblogger::logerr2txt($message); } }