This commit is contained in:
2026-05-20 13:30:10 +02:00
parent bc5cae7e82
commit 22c886b8f4
20 changed files with 1154 additions and 7 deletions

View File

@@ -38,11 +38,14 @@ function AppErrorHandler($errno, $errstr, $errfile, $errline) {
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: ".Config::Get('URL_MAIN'));
Header("Location: ".rtrim(Config::Get('URL_MAIN'), '/')."/");
}
} else {
echo "<span style=\"color: red;\">Unknown error type: [$errno] $errstr<br /></span>\n";
@@ -72,11 +75,13 @@ 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: ".Config::Get('URL_MAIN'));
Header("Location: ".rtrim(Config::Get('URL_MAIN'), '/')."/");
}
} else {
echo "<br /><span style=\"color: red;\">Nie obsluzony wyjatek: " , $exception->getMessage(), "</span>\n".getenv('HTTP_REFERER');