From 0c5158b85d762ce5c7fa596fdc51d50ef5064f5b Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 15 Dec 2022 23:29:06 -0500 Subject: [PATCH 1/3] Check that $probed key exists before comparison in OStatus\Subscribe - Address https://github.com/friendica/friendica/issues/11994#issuecomment-1349590054 --- src/Module/OStatus/Subscribe.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/OStatus/Subscribe.php b/src/Module/OStatus/Subscribe.php index 52bd19aef..da05cfa63 100644 --- a/src/Module/OStatus/Subscribe.php +++ b/src/Module/OStatus/Subscribe.php @@ -142,7 +142,7 @@ class Subscribe extends \Friendica\BaseModule $o .= '

' . $counter . '/' . $total . ': ' . $url; $probed = Contact::getByURL($url); - if (in_array($probed['network'], Protocol::FEDERATED)) { + if (!empty($probed['network']) && in_array($probed['network'], Protocol::FEDERATED)) { $result = Contact::createFromProbeForUser($this->session->getLocalUserId(), $probed['url']); if ($result['success']) { $o .= ' - ' . $this->t('success'); From 060936d31e700a2ca65eb1c19f7504b6c4f8a095 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 15 Dec 2022 23:31:32 -0500 Subject: [PATCH 2/3] Ward against empty $contact array in Module\Photo::getPhotoById - Address https://github.com/friendica/friendica/issues/11994#issuecomment-1349591039 --- src/Module/Photo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Photo.php b/src/Module/Photo.php index 5f1d65845..35348be70 100644 --- a/src/Module/Photo.php +++ b/src/Module/Photo.php @@ -377,7 +377,7 @@ class Photo extends BaseModule $url = Contact::getDefaultAvatar($contact ?: [], Proxy::SIZE_SMALL); } } - return MPhoto::createPhotoForExternalResource($url, 0, $mimetext, $contact['blurhash'], $customsize, $customsize); + return MPhoto::createPhotoForExternalResource($url, 0, $mimetext, $contact['blurhash'] ?? null, $customsize, $customsize); case 'header': $fields = ['uid', 'url', 'header', 'network', 'gsid']; $contact = Contact::getById($id, $fields); From 2497817c2a687d10f376f27617b1da35d94d0587 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Thu, 15 Dec 2022 23:33:02 -0500 Subject: [PATCH 3/3] Ward against empty siteinfo in Text\BBCode::embedURL - Address https://github.com/friendica/friendica/issues/11994#issuecomment-1349593196 --- src/Content/Text/BBCode.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Content/Text/BBCode.php b/src/Content/Text/BBCode.php index 62ad04a43..9be7def90 100644 --- a/src/Content/Text/BBCode.php +++ b/src/Content/Text/BBCode.php @@ -2599,7 +2599,7 @@ class BBCode // Bypass attachment if parse url for a comment if (!$tryAttachment) { DI::profiler()->stopRecording(); - return "\n" . '[url=' . $url . ']' . $siteinfo['title'] . '[/url]'; + return "\n" . '[url=' . $url . ']' . ($siteinfo['title'] ?? $url) . '[/url]'; } // Format it as BBCode attachment