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
path: root/lib
diff options
context:
space:
mode:
authorThomas Citharel <tcit@tcit.fr>2022-03-22 12:24:51 +0300
committerCôme Chilliet (Rebase PR Action) <come-nc@users.noreply.github.com>2022-03-24 12:56:44 +0300
commit0456f61c1cab907cbd582cfbf3e942460933f537 (patch)
tree2796e35ab533fe2b0c80ad2c90315d6c1de6ad1b /lib
parentc9ea2363b1e50748b7c85f1e14b036c3d92cc31a (diff)
Fix passing null to strlen
$filter can be null as it's the default value passed in ContactsMenuController. On PHP 8.1 : strlen(): Passing null to parameter #1 ($string) of type string is deprecated Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Contacts/ContactsMenu/ContactsStore.php4
-rw-r--r--lib/private/Contacts/ContactsMenu/Manager.php4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/private/Contacts/ContactsMenu/ContactsStore.php b/lib/private/Contacts/ContactsMenu/ContactsStore.php
index 5b7a942a244..0ac388ce00a 100644
--- a/lib/private/Contacts/ContactsMenu/ContactsStore.php
+++ b/lib/private/Contacts/ContactsMenu/ContactsStore.php
@@ -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(
diff --git a/lib/private/Contacts/ContactsMenu/Manager.php b/lib/private/Contacts/ContactsMenu/Manager.php
index cea67735da5..73a5a475d85 100644
--- a/lib/private/Contacts/ContactsMenu/Manager.php
+++ b/lib/private/Contacts/ContactsMenu/Manager.php
@@ -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);