From 89b4de01a9ce82735e23e7aeb25cecd5eaa46287 Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Fri, 18 Nov 2016 15:49:03 +0000 Subject: [PATCH] (Retrofit from trunk) N.523 UserRights::ListProfiles must return an empty array if nobody is currently logged in (instead of a FATAL ERROR) SVN:2.3[4479] --- core/userrights.class.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/userrights.class.inc.php b/core/userrights.class.inc.php index 04cbfd4b6..8c392c205 100644 --- a/core/userrights.class.inc.php +++ b/core/userrights.class.inc.php @@ -1045,7 +1045,12 @@ class UserRights { $oUser = self::$m_oUser; } - if ($oUser->GetKey() == self::$m_oUser->GetKey()) + if ($oUser === null) + { + // Not logged in: no profile at all + $aProfiles = array(); + } + elseif ((self::$m_oUser !== null) && ($oUser->GetKey() == self::$m_oUser->GetKey())) { // Data about the current user can be found into the session data if (array_key_exists('profile_list', $_SESSION))