diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php index 3db96fa02e205..23dbe8c2334ee 100644 --- a/lib/private/User/Database.php +++ b/lib/private/User/Database.php @@ -259,6 +259,8 @@ public function getDisplayName($uid): string { * @return array an array of all displayNames (value) and the corresponding uids (key) */ public function getDisplayNames($search = '', $limit = null, $offset = null) { + $limit = $this->fixLimit($limit); + $this->fixDI(); $query = $this->dbConn->getQueryBuilder(); @@ -380,6 +382,8 @@ private function loadUser($uid) { * @return string[] an array of all uids */ public function getUsers($search = '', $limit = null, $offset = null) { + $limit = $this->fixLimit($limit); + $users = $this->getDisplayNames($search, $limit, $offset); $userIds = array_map(function ($uid) { return (string)$uid; @@ -485,5 +489,11 @@ public function getRealUID(string $uid): string { return $this->cache[$uid]['uid']; } + private function fixLimit($limit) { + if (is_int($limit) && $limit >= 0) { + return $limit; + } + return null; + } }