Fix PHP warning when array index for role does not exist
Hanno

Hanno commited on 2018-06-21 17:18:31
Zeige 1 geänderte Dateien mit 2 Einfügungen und 0 Löschungen.

... ...
@@ -165,10 +165,12 @@ function logger($severity, $scriptname, $scope, $message)
165 165
 
166 166
   DEBUG("LOGGING $scriptname:$scope:$message");
167 167
   $user = NULL;
168
+  if (array_key_exists("role", $_SESSION)) {
168 169
     if ($_SESSION['role'] & ROLE_SYSTEMUSER)
169 170
       $user = $_SESSION['userinfo']['username'];
170 171
     elseif ($_SESSION['role'] & ROLE_CUSTOMER)
171 172
       $user = $_SESSION['customerinfo']['customerno'];
173
+  }
172 174
 
173 175
   $args = array(":user" => $user,
174 176
                 ":remote" => $_SERVER['REMOTE_ADDR'],
175 177