summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2018-11-27 16:28:25 +0100
committerGitHub <noreply@github.com>2018-11-27 16:28:25 +0100
commitb7e195dd7f265ceb769c4b5a8f0eb5434c69ddd3 (patch)
treec6f1019b761e81661217f49b580cf3f7ffdb8be7
parenta2dd8d05b145a6c0009bc7620c65b94ff9279a89 (diff)
parentd0f341b355df7c8e54deb7c107082baffb93fa4f (diff)
downloadnextcloud-server-b7e195dd7f265ceb769c4b5a8f0eb5434c69ddd3.tar.gz
nextcloud-server-b7e195dd7f265ceb769c4b5a8f0eb5434c69ddd3.zip
Merge pull request #12683 from nextcloud/backport/12650/stable15
[stable15] Fix count on string
-rw-r--r--apps/user_ldap/lib/Access.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php
index fb2582e8266..82947bd6868 100644
--- a/apps/user_ldap/lib/Access.php
+++ b/apps/user_ldap/lib/Access.php
@@ -879,7 +879,7 @@ class Access extends LDAPUtility {
});
}
$this->batchApplyUserAttributes($recordsToUpdate);
- return $this->fetchList($ldapRecords, count($attr) > 1);
+ return $this->fetchList($ldapRecords, $this->manyAttributes($attr));
}
/**
@@ -922,7 +922,7 @@ class Access extends LDAPUtility {
* @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));
}
/**
@@ -2011,4 +2011,17 @@ class Access extends LDAPUtility {
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;
+ }
+
}