From 7f8dbb8e457d1e5534ebb569988d84ee3adaeef7 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 11 Nov 2009 10:38:11 -0800 Subject: Fix bug 1963: Web UI throws warnings during previously open login session after user account is deleted 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 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/util.php') diff --git a/lib/util.php b/lib/util.php index 81160d052..7aca4af8d 100644 --- a/lib/util.php +++ b/lib/util.php @@ -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; + } } } -- cgit v1.2.3-54-g00ecf