Merge pull request #31655 from nextcloud/fix-passing-null-to-strlen

Fix passing null to strlen
pull/31684/head
Côme Chilliet 2022-03-24 14:03:13 +07:00 committed by GitHub
commit fbf1334dc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

@ -107,7 +107,7 @@ class ContactsStore implements IContactsStore {
}
$allContacts = $this->contactsManager->search(
$filter ?: '',
$filter ?? '',
[
'FN',
'EMAIL'
@ -146,7 +146,7 @@ class ContactsStore implements IContactsStore {
*
* @param IUser $self
* @param Entry[] $entries
* @param string $filter
* @param string|null $filter
* @return Entry[] the filtered contacts
*/
private function filterContacts(

@ -59,14 +59,14 @@ class Manager {
/**
* @param IUser $user
* @param string $filter
* @param string|null $filter
* @return array
*/
public function getEntries(IUser $user, $filter) {
$maxAutocompleteResults = max(0, $this->config->getSystemValueInt('sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT));
$minSearchStringLength = $this->config->getSystemValueInt('sharing.minSearchStringLength', 0);
$topEntries = [];
if (strlen($filter) >= $minSearchStringLength) {
if (strlen($filter ?? '') >= $minSearchStringLength) {
$entries = $this->store->getContacts($user, $filter, $maxAutocompleteResults);
$sortedEntries = $this->sortEntries($entries);