From 82a24fbbcaf52dba2d91400e7887b8e2ac109b7a Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 18 Sep 2017 16:07:05 +0200 Subject: [PATCH] Implement method 'destroySession' in class 'Auth' --- src/Auth.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Auth.php b/src/Auth.php index 3a6a11a..b3066da 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -337,6 +337,20 @@ final class Auth extends UserManager { } } + /** + * Destroys all session data + * + * @throws AuthError if an internal problem occurred (do *not* catch) + */ + public function destroySession() { + // remove all session variables without exception + $_SESSION = []; + // delete the session cookie + $this->deleteSessionCookie(); + // let PHP destroy the session + \session_destroy(); + } + /** * Creates a new directive keeping the user logged in ("remember me") *