diff options
author | Malf Furious <m@lfurio.us> | 2018-02-09 01:06:26 -0500 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2018-02-09 01:06:26 -0500 |
commit | 98ca92aa0a8aa9d879dd77ab76672f052b53b8d6 (patch) | |
tree | 0d7d68e3e2a38b240062a7e0416fa62ed76bd927 /app | |
parent | 3561ed3caec4754758a0b90e631dfed746b0c4fb (diff) | |
download | scrott-98ca92aa0a8aa9d879dd77ab76672f052b53b8d6.tar.gz scrott-98ca92aa0a8aa9d879dd77ab76672f052b53b8d6.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | app/class/user.class.php | 12 |
1 files changed, 11 insertions, 1 deletions
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; + } } /* |