summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalf Furious <m@lfurio.us>2018-02-09 01:06:26 -0500
committerMalf Furious <m@lfurio.us>2018-02-09 01:06:26 -0500
commit98ca92aa0a8aa9d879dd77ab76672f052b53b8d6 (patch)
tree0d7d68e3e2a38b240062a7e0416fa62ed76bd927
parent3561ed3caec4754758a0b90e631dfed746b0c4fb (diff)
downloadscrott-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.
-rw-r--r--app/class/user.class.php12
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;
+ }
}
/*