]> git.mxchange.org Git - friendica.git/commitdiff
Fix fatal execution path for found Network::get() parameter execption
authornupplaPhil <admin+github@philipp.info>
Sat, 7 Mar 2020 12:39:09 +0000 (13:39 +0100)
committerHypolite Petovan <hypolite@mrpetovan.com>
Tue, 21 Jul 2020 07:19:05 +0000 (03:19 -0400)
src/Model/Item.php
src/Protocol/ActivityPub.php
src/Protocol/ActivityPub/Processor.php

index e31097f53cc48f2d75b02a80e0cedc8f2a60f0fd..46f2fb09a78cb370e381da356f7e35a0c9c04d21 100644 (file)
@@ -3639,7 +3639,7 @@ class Item
         *
         * @return integer item id
         */
-       public static function fetchByLink($uri, $uid = 0)
+       public static function fetchByLink(string $uri, int $uid = 0)
        {
                $item_id = self::searchByLink($uri, $uid);
                if (!empty($item_id)) {
@@ -3692,7 +3692,7 @@ class Item
         *
         * @return array item array with data from the original item
         */
-       public static function addShareDataFromOriginal($item)
+       public static function addShareDataFromOriginal(array $item)
        {
                $shared = self::getShareArray($item);
                if (empty($shared)) {
@@ -3714,9 +3714,9 @@ class Item
                        }
 
                        // Otherwhise try to find (and possibly fetch) the item via the link. This should work for Diaspora and ActivityPub posts
-                       $id = self::fetchByLink($shared['link'], $uid);
+                       $id = self::fetchByLink($shared['link'] ?? '', $uid);
                        if (empty($id)) {
-                               Logger::info('Original item not found', ['url' => $shared['link'], 'callstack' => System::callstack()]);
+                               Logger::info('Original item not found', ['url' => $shared['link'] ?? '', 'callstack' => System::callstack()]);
                                return $item;
                        }
 
index 6b29eabce513f0f0f5092e5c7f6a7a1bdf8b71bb..3c4f4f2e67f6be61aa5e7588f74586572c6fa7d9 100644 (file)
@@ -87,7 +87,7 @@ class ActivityPub
         * @return array
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public static function fetchContent($url, $uid = 0)
+       public static function fetchContent(string $url, int $uid = 0)
        {
                if (!empty($uid)) {
                        return HTTPSignature::fetch($url, $uid);
index e4cef17045a81378fac75ef7b1176236721afe30..04d8a7467f873bf140470b6034c2b7073906a000 100644 (file)
@@ -681,7 +681,7 @@ class Processor
         * @return string fetched message URL
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public static function fetchMissingActivity($url, $child = [])
+       public static function fetchMissingActivity(string $url, array $child = [])
        {
                if (!empty($child['receiver'])) {
                        $uid = ActivityPub\Receiver::getFirstUserFromReceivers($child['receiver']);