From 9a270de9c2de6a93fe081a2c0d8d83de6b6a82b3 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 29 Jan 2023 00:11:13 -0500 Subject: [PATCH] Prevent the use of $shared_item if it's falsy in Mastodon\Status::createQuote - Address https://github.com/friendica/friendica/issues/12488#issuecomment-1407342324 --- src/Factory/Api/Mastodon/Status.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Factory/Api/Mastodon/Status.php b/src/Factory/Api/Mastodon/Status.php index acc7afeb5e..9f6d3bcde9 100644 --- a/src/Factory/Api/Mastodon/Status.php +++ b/src/Factory/Api/Mastodon/Status.php @@ -285,8 +285,7 @@ class Status extends BaseFactory { if (empty($item['quote-uri-id'])) { $media = Post\Media::getByURIId($item['uri-id'], [Post\Media::ACTIVITY]); - if (!empty($media)) { - $shared_item = Post::selectFirst(['uri-id'], ['plink' => $media[0]['url'], 'uid' => [$uid, 0]]); + if (!empty($media) && $shared_item = Post::selectFirst(['uri-id'], ['plink' => $media[0]['url'], 'uid' => [$uid, 0]])) { $quote_id = $shared_item['uri-id']; } } else { -- 2.39.5