errors = []; } public function error($errno, $errstr, $errfile, $errline): void { $errstr = htmlspecialchars($errstr); $this->errors[] = "Error[$errno]: $errstr in $errfile at line $errline"; die(); } public function exception($exception): void { $this->errors[] = "Uncaught Exception: " . $exception; } public function __destruct() { if (!$this->errors) { return; } ob_end_clean(); // Remove current output to be replaced by error page http_response_code(500); header_remove(); echo ''; echo '

Error!!1 (✖﹏✖)

'; echo '

Oisann! Dette var ikke ment å skje. Dersom det vedvarer, vennligst kontakt nettadministratoren.

'; foreach ($this->errors as $error) { echo "
$error
"; } } }