diff options
author | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-01-18 15:45:00 +0100 |
---|---|---|
committer | Côme Chilliet <come.chilliet@nextcloud.com> | 2022-01-24 11:16:44 +0100 |
commit | a6eb7dc676dd18ad153fc920f9b13e802974c94f (patch) | |
tree | 9b30259c1eb93ac3f7e1614c6440b2d228cb6db8 /lib/private | |
parent | d630af4ca80d4e0ab37197df2bc8a0f98ea674a4 (diff) | |
download | nextcloud-server-a6eb7dc676dd18ad153fc920f9b13e802974c94f.tar.gz nextcloud-server-a6eb7dc676dd18ad153fc920f9b13e802974c94f.zip |
Fix signatures and null $userId corner case
Configuration values are sometimes queried when there is no user in
session, so $userId is null and we just want to return the default
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/AllConfig.php | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php index b26bcc06a2b..7d32c1dbc6c 100644 --- a/lib/private/AllConfig.php +++ b/lib/private/AllConfig.php @@ -312,7 +312,7 @@ class AllConfig implements \OCP\IConfig { /** * Getting a user defined value * - * @param string $userId the userId of the user that we want to store the value under + * @param ?string $userId the userId of the user that we want to store the value under * @param string $appName the appName that we stored the value under * @param string $key the key under which the value is being stored * @param mixed $default the default value to be returned if the value isn't set @@ -400,19 +400,19 @@ class AllConfig implements \OCP\IConfig { /** * Returns all user configs sorted by app of one user * - * @param string $userId the user ID to get the app configs from + * @param ?string $userId the user ID to get the app configs from * @return array[] - 2 dimensional array with the following structure: * [ $appId => * [ $key => $value ] * ] */ - public function getAllUserValues(string $userId): array { + public function getAllUserValues(?string $userId): array { if (isset($this->userCache[$userId])) { return $this->userCache[$userId]; } if ($userId === null || $userId === '') { - $this->userCache[$userId] = []; - return $this->userCache[$userId]; + $this->userCache[''] = []; + return $this->userCache['']; } // TODO - FIXME |