From 98ca92aa0a8aa9d879dd77ab76672f052b53b8d6 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Fri, 9 Feb 2018 01:06:26 -0500 Subject: Fix bug in function user::getCurrent() If the session is set to an invalid (eg: deleted) user GUID, an exception is (correctly) thrown. This commit catches that and enables getCurrent() to close the bad session and return NULL. --- app/class/user.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'app/class') diff --git a/app/class/user.class.php b/app/class/user.class.php index 81fc29f..6f05570 100644 --- a/app/class/user.class.php +++ b/app/class/user.class.php @@ -146,7 +146,17 @@ class user extends agent return NULL; } - return new user($_SESSION['userguid']); + try + { + return new user($_SESSION['userguid']); + } + catch (Exception $e) + { + /* invalid user */ + self::setCurrent(); + location("/"); + return NULL; + } } /* -- cgit v1.2.3