diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php index 4e13d70371b7f..a58aec4aeeac2 100644 --- a/lib/private/AllConfig.php +++ b/lib/private/AllConfig.php @@ -358,12 +358,17 @@ public function deleteAppFromAllUsers($appName) { * ] */ private function getUserValues($userId) { - // TODO - FIXME - $this->fixDIInit(); - if (isset($this->userCache[$userId])) { return $this->userCache[$userId]; } + if ($userId === null || $userId === '') { + $this->userCache[$userId]=array(); + return $this->userCache[$userId]; + } + + // TODO - FIXME + $this->fixDIInit(); + $data = array(); $query = 'SELECT `appid`, `configkey`, `configvalue` FROM `*PREFIX*preferences` WHERE `userid` = ?'; $result = $this->connection->executeQuery($query, array($userId)); diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php index e4144fdbe200e..8be24fc50de97 100644 --- a/lib/private/Group/Database.php +++ b/lib/private/Group/Database.php @@ -202,6 +202,11 @@ public function removeFromGroup( $uid, $gid ) { * if the user exists at all. */ public function getUserGroups( $uid ) { + //guests has empty or null $uid + if ($uid === null || $uid === '') { + return []; + } + $this->fixDI(); // No magic! diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php index 69826f49be30f..a281572ad5584 100644 --- a/lib/private/User/Database.php +++ b/lib/private/User/Database.php @@ -75,7 +75,6 @@ class Database extends Backend implements IUserBackend { */ public function __construct($eventDispatcher = null) { $this->cache = new CappedMemoryCache(); - $this->cache[null] = false; $this->eventDispatcher = $eventDispatcher ? $eventDispatcher : \OC::$server->getEventDispatcher(); } @@ -239,6 +238,12 @@ public function checkPassword($uid, $password) { */ private function loadUser($uid) { if (!isset($this->cache[$uid])) { + //guests $uid could be NULL or '' + if ($uid === null || $uid === '') { + $this->cache[$uid]=false; + return true; + } + $query = \OC_DB::prepare('SELECT `uid`, `displayname` FROM `*PREFIX*users` WHERE LOWER(`uid`) = LOWER(?)'); $result = $query->execute(array($uid));