diff --git a/mod/ping.php b/mod/ping.php index 6efa889c7..64c947e2c 100644 --- a/mod/ping.php +++ b/mod/ping.php @@ -139,7 +139,7 @@ function ping_init(App $a) local_user(), Verb::getID(Activity::FOLLOW)]; $items = Post::selectForUser(local_user(), ['wall', 'uid', 'uri-id'], $condition); if (DBA::isResult($items)) { - $items_unseen = Post::toArray($items); + $items_unseen = Post::toArray($items, false); $arr = ['items' => $items_unseen]; Hook::callAll('network_ping', $arr); diff --git a/src/Model/APContact.php b/src/Model/APContact.php index 863496dbb..cc84df4a5 100644 --- a/src/Model/APContact.php +++ b/src/Model/APContact.php @@ -235,7 +235,7 @@ class APContact unset($parts['path']); if (empty($apcontact['addr'])) { - if (!empty($apcontact['nick'])) { + if (!empty($apcontact['nick']) && is_array($parts)) { $apcontact['addr'] = $apcontact['nick'] . '@' . str_replace('//', '', Network::unparseURL($parts)); } else { $apcontact['addr'] = ''; diff --git a/src/Object/Post.php b/src/Object/Post.php index 6973fd236..2e6eb1bf6 100644 --- a/src/Object/Post.php +++ b/src/Object/Post.php @@ -887,8 +887,13 @@ class Post $terms = Tag::getByURIId($item['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]); foreach ($terms as $term) { + if (!$term['url']) { + DI::logger()->warning('Mention term with no URL', ['term' => $term]); + continue; + } + $profile = Contact::getByURL($term['url'], false, ['addr', 'contact-type']); - if (!empty($profile['addr']) && ((($profile['contact-type'] ?? '') ?: Contact::TYPE_UNKNOWN) != Contact::TYPE_COMMUNITY) && + if (!empty($profile['addr']) && (($profile['contact-type'] ?? Contact::TYPE_UNKNOWN) != Contact::TYPE_COMMUNITY) && ($profile['addr'] != $owner['addr']) && !strstr($text, $profile['addr'])) { $text .= '@' . $profile['addr'] . ' '; } @@ -945,9 +950,9 @@ class Post '$qcomment' => $qcomment, '$default' => $default_text, '$profile_uid' => $uid, - '$mylink' => DI::baseUrl()->remove($a->contact['url']), + '$mylink' => DI::baseUrl()->remove($a->contact['url'] ?? ''), '$mytitle' => DI::l10n()->t('This is you'), - '$myphoto' => DI::baseUrl()->remove($a->contact['thumb']), + '$myphoto' => DI::baseUrl()->remove($a->contact['thumb'] ?? ''), '$comment' => DI::l10n()->t('Comment'), '$submit' => DI::l10n()->t('Submit'), '$loading' => DI::l10n()->t('Loading...'), diff --git a/src/Util/ParseUrl.php b/src/Util/ParseUrl.php index 5dee4d3a2..d5c9f02ad 100644 --- a/src/Util/ParseUrl.php +++ b/src/Util/ParseUrl.php @@ -695,7 +695,7 @@ class ParseUrl { if (!empty($jsonld['@graph']) && is_array($jsonld['@graph'])) { foreach ($jsonld['@graph'] as $part) { - if (!empty($part)) { + if (!empty($part) && is_array($part)) { $siteinfo = self::parseParts($siteinfo, $part); } }