Merge pull request #14187 from annando/error

Fix "TypeError: Argument 1 passed to Friendica\Util\Strings::compareLink() must be of the type string, null given"
This commit is contained in:
Hypolite Petovan 2024-05-27 19:08:06 -04:00 committed by GitHub
commit 87da9c98f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3557,6 +3557,10 @@ class Contact
*/
public static function magicLinkById(int $cid, string $url = ''): string
{
if (($url == '') && DI::userSession()->isAuthenticated() && DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'stay_local')) {
return 'contact/' . $cid . '/conversations';
}
$contact = DBA::selectFirst('contact', ['id', 'network', 'url', 'alias', 'uid'], ['id' => $cid]);
return self::magicLinkByContact($contact, $url);
@ -3584,7 +3588,7 @@ class Contact
return 'contact/' . $contact['id'] . '/conversations';
}
if (Strings::compareLink($contact['url'], $url) || Strings::compareLink($contact['alias'], $url)) {
if (Strings::compareLink($contact['url'], $url) || Strings::compareLink($contact['alias'] ?? '', $url)) {
$url = '';
}