Skip to content

Commit

Permalink
Merge pull request #12650 from nextcloud/bugfix/12614/count-on-string
Browse files Browse the repository at this point in the history
Fix count on string
  • Loading branch information
MorrisJobke authored Nov 27, 2018
2 parents ebd6231 + 6ce849f commit 95857a8
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions apps/user_ldap/lib/Access.php
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ public function fetchListOfUsers($filter, $attr, $limit = null, $offset = null,
});
}
$this->batchApplyUserAttributes($recordsToUpdate);
return $this->fetchList($ldapRecords, count($attr) > 1);
return $this->fetchList($ldapRecords, $this->manyAttributes($attr));
}

/**
Expand Down Expand Up @@ -922,7 +922,7 @@ public function batchApplyUserAttributes(array $ldapRecords){
* @return array
*/
public function fetchListOfGroups($filter, $attr, $limit = null, $offset = null) {
return $this->fetchList($this->searchGroups($filter, $attr, $limit, $offset), count($attr) > 1);
return $this->fetchList($this->searchGroups($filter, $attr, $limit, $offset), $this->manyAttributes($attr));
}

/**
Expand Down Expand Up @@ -2011,4 +2011,17 @@ private function initPagedSearch($filter, $bases, $attr, $limit, $offset) {
return $pagedSearchOK;
}

/**
* Is more than one $attr used for search?
*
* @param string|string[]|null $attr
* @return bool
*/
private function manyAttributes($attr): bool {
if (\is_array($attr)) {
return \count($attr) > 1;
}
return false;
}

}

0 comments on commit 95857a8

Please sign in to comment.