From 316f7ff858c3146147251414808c1d3713bdd70b Mon Sep 17 00:00:00 2001 From: Shish Date: Sun, 7 Dec 2014 03:44:03 +0000 Subject: [PATCH] Give a better error if User::class has been screwed up somehow --- core/user.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/user.class.php b/core/user.class.php index 60c8fa48..65bb9c83 100644 --- a/core/user.class.php +++ b/core/user.class.php @@ -55,7 +55,13 @@ class User { $this->email = $row['email']; $this->join_date = $row['joindate']; $this->passhash = $row['pass']; - $this->class = $_user_classes[$row["class"]]; + + if(array_key_exists($row["class"], $_user_classes)) { + $this->class = $_user_classes[$row["class"]]; + } + else { + throw SCoreException("User '{$this->name}' has invalid class '{$row["class"]}'"); + } } /**