Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-03-08 12:21:54 +0300
committerCôme Chilliet <come.chilliet@nextcloud.com>2022-03-08 12:21:54 +0300
commitdf29acb3433ef3de7955f9336981ecd6894622ae (patch)
tree8011fc89530076d75a4a66d58e2882337f4ad6d2
parentdab5ea958a58e79b7f40b49bbe3af8839dc9c9d1 (diff)
Set $limit as int as well in Access::count private methodfix/user_ldap-fix-ldap-connection-resets
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r--apps/user_ldap/lib/Access.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php
index daa5d343185..29d60817c02 100644
--- a/apps/user_ldap/lib/Access.php
+++ b/apps/user_ldap/lib/Access.php
@@ -982,7 +982,7 @@ class Access extends LDAPUtility {
public function countUsers(string $filter, array $attr = ['dn'], int $limit = null, int $offset = null) {
$result = false;
foreach ($this->connection->ldapBaseUsers as $base) {
- $count = $this->count($filter, [$base], $attr, $limit, $offset ?? 0);
+ $count = $this->count($filter, [$base], $attr, $limit ?? 0, $offset ?? 0);
$result = is_int($count) ? (int)$result + $count : $result;
}
return $result;
@@ -1013,7 +1013,7 @@ class Access extends LDAPUtility {
public function countGroups(string $filter, array $attr = ['dn'], int $limit = null, int $offset = null) {
$result = false;
foreach ($this->connection->ldapBaseGroups as $base) {
- $count = $this->count($filter, [$base], $attr, $limit, $offset ?? 0);
+ $count = $this->count($filter, [$base], $attr, $limit ?? 0, $offset ?? 0);
$result = is_int($count) ? (int)$result + $count : $result;
}
return $result;
@@ -1028,7 +1028,7 @@ class Access extends LDAPUtility {
public function countObjects(int $limit = null, int $offset = null) {
$result = false;
foreach ($this->connection->ldapBase as $base) {
- $count = $this->count('objectclass=*', [$base], ['dn'], $limit, $offset ?? 0);
+ $count = $this->count('objectclass=*', [$base], ['dn'], $limit ?? 0, $offset ?? 0);
$result = is_int($count) ? (int)$result + $count : $result;
}
return $result;
@@ -1187,8 +1187,8 @@ class Access extends LDAPUtility {
* @param array $bases an array containing the LDAP subtree(s) that shall be searched
* @param ?string[] $attr optional, array, one or more attributes that shall be
* retrieved. Results will according to the order in the array.
- * @param ?int $limit optional, maximum results to be counted
- * @param int $offset optional, a starting point
+ * @param int $limit maximum results to be counted, 0 means no limit
+ * @param int $offset a starting point, defaults to 0
* @param bool $skipHandling indicates whether the pages search operation is
* completed
* @return int|false Integer or false if the search could not be initialized
@@ -1198,7 +1198,7 @@ class Access extends LDAPUtility {
string $filter,
array $bases,
array $attr = null,
- ?int $limit = null,
+ int $limit = 0,
int $offset = 0,
bool $skipHandling = false
) {
@@ -1208,7 +1208,7 @@ class Access extends LDAPUtility {
]);
$limitPerPage = (int)$this->connection->ldapPagingSize;
- if (!is_null($limit) && $limit < $limitPerPage && $limit > 0) {
+ if ($limit < $limitPerPage && $limit > 0) {
$limitPerPage = $limit;
}
@@ -1237,7 +1237,7 @@ class Access extends LDAPUtility {
* Continue now depends on $hasMorePages value
*/
$continue = $pagedSearchOK && $hasMorePages;
- } while ($continue && (is_null($limit) || $limit <= 0 || $limit > $counter));
+ } while ($continue && ($limit <= 0 || $limit > $counter));
}
return $counter;