-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix NULL users? #8765
Fix NULL users? #8765
Conversation
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 ```
Regression of #5585. @LEDfan would you mind taking a look? I'd suggest to check whether the user manager actually returns a user for the given UID before passing it to the group manager. |
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather fix the code that calls the method incorrectly than fixing it here. See #8765 (comment)
Correct NULL should not be passed in. Just check before calling if it is not null. Thus closing this. |
This was closed without any fix referenced. This issue is not one of a third party code but one of Nextcloud itself. As originally stated the issue happens when specific options are selected in the settings. |
When the following options are enabled in Nextcloud 13.0.0 the ContactsMenu fails to load.
The issue is traced back to:
/lib/private/Contacts/ContactsMenu/ContactsStore.php
You'll get the error: