Changeset:
        ef7604ce0988
        
https://sourceforge.net/p/mrbs/hg-code/ci/ef7604ce0988c10b6f9b90384ce906581d1df574
Author:
        Campbell Morrison <[email protected]>
Date:
        Tue Feb 21 11:52:32 2017 +0000
Log message:

Fixed bug causing getUserName() to return '' instead of null in the case of a 
user not being logged in when using the cookie session scheme.

diffstat:

 web/session/session_cookie.inc |  11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diffs (27 lines):

diff -r 41cae1cac811 -r ef7604ce0988 web/session/session_cookie.inc
--- a/web/session/session_cookie.inc    Tue Feb 21 11:49:46 2017 +0000
+++ b/web/session/session_cookie.inc    Tue Feb 21 11:52:32 2017 +0000
@@ -216,19 +216,16 @@
   global $REMOTE_ADDR, $auth;
   
   static $cached_username = null;
+  static $have_checked_cookie = false;
 
-  //error_log("Called getUserName()");
-
-  if (!is_null($cached_username))
+  if ($have_checked_cookie)
   {
-    //error_log("cached");
     return $cached_username;
   }
   
   // If the cached username isn't set, we have to decode the cookie, but
-  // first set the cached username to an empty string, so we will only do
-  // this once
-  $cached_username = "";
+  // first set the flag, so we will only do this once
+  $have_checked_cookie = true;
 
   if (!empty($_COOKIE) && isset($_COOKIE["SessionToken"]))
   {

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to