]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fix bug 1963: Web UI throws warnings during previously open login session after user...
authorBrion Vibber <brion@pobox.com>
Wed, 11 Nov 2009 18:38:11 +0000 (10:38 -0800)
committerBrion Vibber <brion@pobox.com>
Wed, 11 Nov 2009 18:38:11 +0000 (10:38 -0800)
common_logged_in() returned bogus results because it checks against null specifically, but common_current_user() was sticking 'false' into $_cur because that's what User::staticGet() returned from a failed lookup. Now we skip over a failed lookup here, so we keep null and all is well.

lib/util.php

index 81160d052c49ac431655557c2d3b34b064f03bb9..7aca4af8d622910ca9bd90d97c39e630de5fb725 100644 (file)
@@ -350,8 +350,11 @@ function common_current_user()
             common_ensure_session();
             $id = isset($_SESSION['userid']) ? $_SESSION['userid'] : false;
             if ($id) {
-                $_cur = User::staticGet($id);
-                return $_cur;
+                $user = User::staticGet($id);
+                if ($user) {
+                       $_cur = $user;
+                       return $_cur;
+                }
             }
         }