Fixing appending child at DFRN without a parent id.

This commit is contained in:
Philipp Holzer 2019-02-24 16:30:09 +01:00
parent df5ea1fab0
commit bf6a765beb
No known key found for this signature in database
GPG Key ID: 517BE60E2CE5C8A5

View File

@ -119,7 +119,9 @@ class DFRN
$item["entry:cid"] = defaults($item, "entry:cid", 0); $item["entry:cid"] = defaults($item, "entry:cid", 0);
$entry = self::entry($doc, "text", $item, $owner, $item["entry:comment-allow"], $item["entry:cid"]); $entry = self::entry($doc, "text", $item, $owner, $item["entry:comment-allow"], $item["entry:cid"]);
$root->appendChild($entry); if (isset($entry)) {
$root->appendChild($entry);
}
} }
return trim($doc->saveXML()); return trim($doc->saveXML());
@ -323,7 +325,9 @@ class DFRN
} }
$entry = self::entry($doc, $type, $item, $owner, true); $entry = self::entry($doc, $type, $item, $owner, true);
$root->appendChild($entry); if (isset($entry)) {
$root->appendChild($entry);
}
} }
$atom = trim($doc->saveXML()); $atom = trim($doc->saveXML());
@ -390,7 +394,9 @@ class DFRN
foreach ($items as $item) { foreach ($items as $item) {
$entry = self::entry($doc, $type, $item, $owner, true, 0); $entry = self::entry($doc, $type, $item, $owner, true, 0);
$root->appendChild($entry); if (isset($entry)) {
$root->appendChild($entry);
}
} }
} else { } else {
$root = self::entry($doc, $type, $item, $owner, true, 0, true); $root = self::entry($doc, $type, $item, $owner, true, 0, true);
@ -916,7 +922,8 @@ class DFRN
$mentioned = []; $mentioned = [];
if (!$item['parent']) { if (!$item['parent']) {
return; Logger::notice('Item without parent found.', ['type' => $type, 'item' => $item]);
return null;
} }
if ($item['deleted']) { if ($item['deleted']) {