Unknown error type: [$errno] $errstr
\n";
echo $errfile.':'.$errline;
}
break;
default:
if(!preg_match('/mysql_connect()/', $errstr)) {
MFLog::Error("Line: ".$errline." File: ".$errfile." Message: ".$errstr." Referer: ".getenv('HTTP_REFERER'));
if(Config::Get('ERROR_REDIRECT') == 'true') {
// Redirect-loop guard (2026-05-20): log root cause and route with trailing
// slash so mod_dir doesn't issue a https->http degrading 301.
error_log("ErrorHandler redirect: [$errno] $errstr at $errfile:$errline (REQUEST_URI=" . ($_SERVER['REQUEST_URI'] ?? '-') . ")");
if(getenv('HTTP_REFERER')==Config::Get('URL_MAIN')) {
Header("Location: ".Config::Get('URL_MAIN')."/error.html");
} else {
header("HTTP/1.0 302 Moved Temporarily");
Header("Location: ".rtrim(Config::Get('URL_MAIN'), '/')."/");
}
} else {
echo "Unknown error type: [$errno] $errstr
\n";
echo $errfile.':'.$errline;
break;
}
}
}
/* Don't execute PHP internal error handler */
return true;
}
set_error_handler("AppErrorHandler");
/**
* Obsluguje wyjatki
*
* @param Exception $exception
*/
function ExceptionHandler($exception) {
MFLog::Error("Line: ".$exception->getLine()." Message: ".$exception->getMessage()." Referer: ".getenv('HTTP_REFERER'));
if(ERROR_REDIRECT == 'true') {
// Redirect-loop guard (2026-05-20): log root cause and route with trailing slash.
error_log("ExceptionHandler redirect: " . $exception->getMessage() . " at " . $exception->getFile() . ":" . $exception->getLine() . " (REQUEST_URI=" . ($_SERVER['REQUEST_URI'] ?? '-') . ")");
if(getenv('HTTP_REFERER')==Config::Get('URL_MAIN')) {
Header("Location: ".Config::Get('URL_MAIN')."/error.html");
} else {
header("HTTP/1.0 302 Moved Temporarily");
Header("Location: ".rtrim(Config::Get('URL_MAIN'), '/')."/");
}
} else {
echo "
Nie obsluzony wyjatek: " , $exception->getMessage(), "\n".getenv('HTTP_REFERER');
echo $exception;
}
}
set_exception_handler('ExceptionHandler');
if(Config::Get('ERROR_REDIRECT') == true) {
ini_set('html_errors',false);
ini_set('error_prepend_string','