From b7bc71dca697ffba0a9c6ec447c4a2a88f5d58e4 Mon Sep 17 00:00:00 2001 From: Shinrai Date: Fri, 9 Mar 2018 17:53:22 -0800 Subject: [PATCH] Fix NULL users? When the following options are enabled in Nextcloud 13.0.0 the ContactsMenu fails to load. ``` Restrict users to only share with users in their groups Allow username autocompletion in share dialog. If this is disabled the full username or email address needs to be entered. ``` The issue is traced back to: ### /lib/private/Contacts/ContactsMenu/ContactsStore.php ```PHP $contactGroups = $this->groupManager->getUserGroupIds($this->userManager->get($entry->getProperty('UID'))); ``` You'll get the error: ``` TypeError: Argument 1 passed to OC\Group\Manager::getUserGroupIds() must implement interface OCP\IUser, null given, called in /nextcloud/lib/private/Contacts/ContactsMenu/ContactsStore.php on line 161 ``` --- lib/private/Group/Manager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php index 2d40b44799695..a0d7bf0819da6 100644 --- a/lib/private/Group/Manager.php +++ b/lib/private/Group/Manager.php @@ -323,7 +323,7 @@ public function isInGroup($userId, $group) { * @param IUser $user * @return array with group ids */ - public function getUserGroupIds(IUser $user) { + public function getUserGroupIds(IUser $user = null) { return array_map(function($value) { return (string) $value; }, array_keys($this->getUserGroups($user)));