Skip to content

Commit fbf1334

Browse files
authored
Merge pull request #31655 from nextcloud/fix-passing-null-to-strlen
Fix passing null to strlen
2 parents c9ea236 + 0456f61 commit fbf1334

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/private/Contacts/ContactsMenu/ContactsStore.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function getContacts(IUser $user, $filter, ?int $limit = null, ?int $offs
107107
}
108108

109109
$allContacts = $this->contactsManager->search(
110-
$filter ?: '',
110+
$filter ?? '',
111111
[
112112
'FN',
113113
'EMAIL'
@@ -146,7 +146,7 @@ public function getContacts(IUser $user, $filter, ?int $limit = null, ?int $offs
146146
*
147147
* @param IUser $self
148148
* @param Entry[] $entries
149-
* @param string $filter
149+
* @param string|null $filter
150150
* @return Entry[] the filtered contacts
151151
*/
152152
private function filterContacts(

lib/private/Contacts/ContactsMenu/Manager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ public function __construct(ContactsStore $store, ActionProviderStore $actionPro
5959

6060
/**
6161
* @param IUser $user
62-
* @param string $filter
62+
* @param string|null $filter
6363
* @return array
6464
*/
6565
public function getEntries(IUser $user, $filter) {
6666
$maxAutocompleteResults = max(0, $this->config->getSystemValueInt('sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT));
6767
$minSearchStringLength = $this->config->getSystemValueInt('sharing.minSearchStringLength', 0);
6868
$topEntries = [];
69-
if (strlen($filter) >= $minSearchStringLength) {
69+
if (strlen($filter ?? '') >= $minSearchStringLength) {
7070
$entries = $this->store->getContacts($user, $filter, $maxAutocompleteResults);
7171

7272
$sortedEntries = $this->sortEntries($entries);

0 commit comments

Comments
 (0)