Browse Source

Merge pull request #6504 from annando/fix-fatal

Fix for several fatal errors
pull/6506/head
Hypolite Petovan 2 years ago
committed by GitHub
parent
commit
bce8ab7227
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 13 deletions
  1. +2
    -4
      src/Content/OEmbed.php
  2. +3
    -3
      src/Content/Widget/ContactBlock.php
  3. +1
    -0
      src/Module/Inbox.php
  4. +3
    -3
      src/Protocol/DFRN.php
  5. +2
    -2
      src/Protocol/OStatus.php
  6. +1
    -1
      src/Worker/Notifier.php

+ 2
- 4
src/Content/OEmbed.php View File

@ -86,8 +86,7 @@ class OEmbed
$redirects = 0;
$html_text = Network::fetchUrl($embedurl, false, $redirects, 15, 'text/*');
if ($html_text) {
$dom = new DOMDocument();
$dom->loadHTML($html_text);
$dom = @DOMDocument::loadHTML($html_text);
if ($dom) {
$xpath = new DOMXPath($dom);
$entries = $xpath->query("//link[@type='application/json+oembed']");
@ -275,8 +274,7 @@ class OEmbed
$html_text = mb_convert_encoding($text, 'HTML-ENTITIES', mb_detect_encoding($text));
// If it doesn't parse at all, just return the text.
$dom = new DOMDocument();
$dom->loadHTML($html_text);
$dom = @DOMDocument::loadHTML($html_text);
if (!$dom) {
return $text;
}


+ 3
- 3
src/Content/Widget/ContactBlock.php View File

@ -57,9 +57,9 @@ class ContactBlock
$contacts_title = L10n::t('No contacts');
if (!$total) {
$micropro = [];
} else {
$micropro = [];
if ($total) {
// Only show followed for personal accounts, followers for pages
if (defaults($profile, 'account-type', User::ACCOUNT_TYPE_PERSON) == User::ACCOUNT_TYPE_PERSON) {
$rel = [Contact::FOLLOWER, Contact::FRIEND];


+ 1
- 0
src/Module/Inbox.php View File

@ -10,6 +10,7 @@ use Friendica\Protocol\ActivityPub;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Util\HTTPSignature;
use Friendica\Core\Config;
/**
* ActivityPub Inbox


+ 3
- 3
src/Protocol/DFRN.php View File

@ -2512,7 +2512,7 @@ class DFRN
}
$notice_info = $xpath->query("statusnet:notice_info", $entry);
if ($notice_info && ($notice_info->length > 0)) {
if ($notice_info && ($notice_info->length > 0) && !empty($notice_info->item)) {
foreach ($notice_info->item[0]->attributes as $attributes) {
if ($attributes->name == "source") {
$item["app"] = strip_tags($attributes->textContent);
@ -2588,7 +2588,7 @@ class DFRN
$item['conversation-uri'] = XML::getFirstNodeValue($xpath, 'ostatus:conversation/text()', $entry);
$conv = $xpath->query('ostatus:conversation', $entry);
if (is_object($conv->item[0])) {
if (!empty($conv->item[0])) {
foreach ($conv->item[0]->attributes as $attributes) {
if ($attributes->name == "ref") {
$item['conversation-uri'] = $attributes->textContent;
@ -2603,7 +2603,7 @@ class DFRN
$item["parent-uri"] = $item["uri"];
$inreplyto = $xpath->query("thr:in-reply-to", $entry);
if (is_object($inreplyto->item[0])) {
if (!empty($inreplyto->item[0])) {
foreach ($inreplyto->item[0]->attributes as $attributes) {
if ($attributes->name == "ref") {
$item["parent-uri"] = $attributes->textContent;


+ 2
- 2
src/Protocol/OStatus.php View File

@ -53,7 +53,7 @@ class OStatus
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function fetchAuthor(DOMXPath $xpath, $context, array $importer, array &$contact, $onlyfetch)
private static function fetchAuthor(DOMXPath $xpath, $context, array $importer, array &$contact = null, $onlyfetch)
{
$author = [];
$author["author-link"] = XML::getFirstNodeValue($xpath, 'atom:author/atom:uri/text()', $context);
@ -322,7 +322,7 @@ class OStatus
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
private static function process($xml, array $importer, array &$contact, &$hub, $stored = false, $initialize = true)
private static function process($xml, array $importer, array &$contact = null, &$hub, $stored = false, $initialize = true)
{
if ($initialize) {
self::$itemlist = [];


+ 1
- 1
src/Worker/Notifier.php View File

@ -152,7 +152,7 @@ class Notifier
if (!empty($target_item) && !empty($items)) {
$parent = $items[0];
$delivery_queue_count += self::activityPubDelivery($cmd, $target_item, $parent, $a->queue['priority'], $a->query_string['created']);
$delivery_queue_count += self::activityPubDelivery($cmd, $target_item, $parent, $a->queue['priority'], $a->queue['created']);
$fields = ['network', 'author-id', 'owner-id'];
$condition = ['uri' => $target_item["thr-parent"], 'uid' => $target_item["uid"]];


Loading…
Cancel
Save