Register ErrorHandler before Session start.

This commit is contained in:
Aaron van Geffen 2020-03-11 22:36:21 +01:00
parent a208c0482f
commit 31f4edc996
1 changed files with 3 additions and 4 deletions

View File

@ -16,16 +16,15 @@ require_once 'vendor/autoload.php';
Registry::set('start', microtime(true));
Registry::set('db', new Database(DB_SERVER, DB_USER, DB_PASS, DB_NAME));
// Handle errors our own way.
ErrorHandler::enable();
// Do some authentication checks.
Session::start();
$user = Authentication::isLoggedIn() ? Member::fromId($_SESSION['user_id']) : new Guest();
$user->updateAccessTime();
Registry::set('user', $user);
// Handle errors our own way.
set_error_handler('ErrorHandler::handleError');
ini_set("display_errors", DEBUG ? "On" : "Off");
// The real magic starts here!
ob_start();
Dispatcher::dispatch();