Skip to content

Commit

Permalink
Merge pull request #31655 from nextcloud/fix-passing-null-to-strlen
Browse files Browse the repository at this point in the history
Fix passing null to strlen
  • Loading branch information
come-nc authored Mar 24, 2022
2 parents c9ea236 + 0456f61 commit fbf1334
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/private/Contacts/ContactsMenu/ContactsStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function getContacts(IUser $user, $filter, ?int $limit = null, ?int $offs
}

$allContacts = $this->contactsManager->search(
$filter ?: '',
$filter ?? '',
[
'FN',
'EMAIL'
Expand Down Expand Up @@ -146,7 +146,7 @@ public function getContacts(IUser $user, $filter, ?int $limit = null, ?int $offs
*
* @param IUser $self
* @param Entry[] $entries
* @param string $filter
* @param string|null $filter
* @return Entry[] the filtered contacts
*/
private function filterContacts(
Expand Down
4 changes: 2 additions & 2 deletions lib/private/Contacts/ContactsMenu/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ public function __construct(ContactsStore $store, ActionProviderStore $actionPro

/**
* @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);
Expand Down

0 comments on commit fbf1334

Please sign in to comment.