From af2dffeb2225bc2556ef19c52cbc2801e84033ab Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Tue, 22 Mar 2022 10:24:51 +0100 Subject: [PATCH] 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 --- lib/private/Contacts/ContactsMenu/Manager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/private/Contacts/ContactsMenu/Manager.php b/lib/private/Contacts/ContactsMenu/Manager.php index cea67735da56f..fbedff9f1a678 100644 --- a/lib/private/Contacts/ContactsMenu/Manager.php +++ b/lib/private/Contacts/ContactsMenu/Manager.php @@ -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 ($filter && strlen($filter) >= $minSearchStringLength) { $entries = $this->store->getContacts($user, $filter, $maxAutocompleteResults); $sortedEntries = $this->sortEntries($entries);