' . $errorMsg . '
$value) { if (is_array($value)) continue; $getStr[] = $key . "=" . $value; } $userMsg = ""; if (isset($_SESSION['anmnam'])) $userMsg .= " User: " . $_SESSION["anmnam"]; if (isset($_SESSION['username'])) $userMsg .= " (" . $_SESSION["username"] . ")"; if ($userMsg) $userMsg = " |--" . $userMsg; $errorMsg = ""; if (!empty($_SERVER) && !empty($_SERVER["HTTP_HOST"])) { $errorPage = $_SERVER['PHP_SELF'] . "?" . implode("&", $getStr); $errorPageFull = "https://" . $_SERVER["HTTP_HOST"] . $errorPage; $errorMsg = "*$errno ($string) at $file: line_ $line _"; $errorMsg .= $userMsg; $errorMsg .= " |-- Error generating page: $errorPage"; $errorMsg .= " |-- Used RAM / Peak RAM / Allowed: " . MD_STD::human_filesize(memory_get_usage()) . " / " . MD_STD::human_filesize(memory_get_peak_usage()) . " / " . ini_get("memory_limit"); $errorMsg = str_replace(PHP_EOL, " ", $errorMsg); error_log($errorMsg); } if ($errno == E_ERROR) exit; } /** * Exception handler to also be able to handle custom exceptions. * * @param Throwable $exception Exception. * * @return void */ function mdExceptionHandler(Throwable $exception):void { $formatErrorPage = function(string $errorMsg = "", string $versionName = "") :string { if (PHP_SAPI === "cli") { return $errorMsg . PHP_EOL; } $output = '
'; $output .= '' . $errorMsg . '