Merge pull request #10229 from MrPetovan/bug/fatal-errors

Fix several fatal errors
This commit is contained in:
Tobias Diekershoff 2021-05-11 06:08:41 +02:00 committed by GitHub
commit f6ca5dbcc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 6 deletions

View File

@ -139,7 +139,7 @@ function ping_init(App $a)
local_user(), Verb::getID(Activity::FOLLOW)]; local_user(), Verb::getID(Activity::FOLLOW)];
$items = Post::selectForUser(local_user(), ['wall', 'uid', 'uri-id'], $condition); $items = Post::selectForUser(local_user(), ['wall', 'uid', 'uri-id'], $condition);
if (DBA::isResult($items)) { if (DBA::isResult($items)) {
$items_unseen = Post::toArray($items); $items_unseen = Post::toArray($items, false);
$arr = ['items' => $items_unseen]; $arr = ['items' => $items_unseen];
Hook::callAll('network_ping', $arr); Hook::callAll('network_ping', $arr);

View File

@ -235,7 +235,7 @@ class APContact
unset($parts['path']); unset($parts['path']);
if (empty($apcontact['addr'])) { if (empty($apcontact['addr'])) {
if (!empty($apcontact['nick'])) { if (!empty($apcontact['nick']) && is_array($parts)) {
$apcontact['addr'] = $apcontact['nick'] . '@' . str_replace('//', '', Network::unparseURL($parts)); $apcontact['addr'] = $apcontact['nick'] . '@' . str_replace('//', '', Network::unparseURL($parts));
} else { } else {
$apcontact['addr'] = ''; $apcontact['addr'] = '';

View File

@ -887,8 +887,13 @@ class Post
$terms = Tag::getByURIId($item['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]); $terms = Tag::getByURIId($item['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);
foreach ($terms as $term) { 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']); $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'])) { ($profile['addr'] != $owner['addr']) && !strstr($text, $profile['addr'])) {
$text .= '@' . $profile['addr'] . ' '; $text .= '@' . $profile['addr'] . ' ';
} }
@ -945,9 +950,9 @@ class Post
'$qcomment' => $qcomment, '$qcomment' => $qcomment,
'$default' => $default_text, '$default' => $default_text,
'$profile_uid' => $uid, '$profile_uid' => $uid,
'$mylink' => DI::baseUrl()->remove($a->contact['url']), '$mylink' => DI::baseUrl()->remove($a->contact['url'] ?? ''),
'$mytitle' => DI::l10n()->t('This is you'), '$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'), '$comment' => DI::l10n()->t('Comment'),
'$submit' => DI::l10n()->t('Submit'), '$submit' => DI::l10n()->t('Submit'),
'$loading' => DI::l10n()->t('Loading...'), '$loading' => DI::l10n()->t('Loading...'),

View File

@ -695,7 +695,7 @@ class ParseUrl
{ {
if (!empty($jsonld['@graph']) && is_array($jsonld['@graph'])) { if (!empty($jsonld['@graph']) && is_array($jsonld['@graph'])) {
foreach ($jsonld['@graph'] as $part) { foreach ($jsonld['@graph'] as $part) {
if (!empty($part)) { if (!empty($part) && is_array($part)) {
$siteinfo = self::parseParts($siteinfo, $part); $siteinfo = self::parseParts($siteinfo, $part);
} }
} }