Skip to content

Commit

Permalink
Fix passing null to strlen
Browse files Browse the repository at this point in the history
$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>
  • Loading branch information
tcitworld committed Mar 22, 2022
1 parent 0fdb415 commit af2dffe
Showing 1 changed file with 2 additions and 2 deletions.
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 ($filter && strlen($filter) >= $minSearchStringLength) {
$entries = $this->store->getContacts($user, $filter, $maxAutocompleteResults);

$sortedEntries = $this->sortEntries($entries);
Expand Down

0 comments on commit af2dffe

Please sign in to comment.