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)];
$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);

View file

@ -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'] = '';

View file

@ -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...'),

View file

@ -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);
}
}