Merge pull request #6749 from nupplaphil/6386-php_fatal
Fixing appending child at DFRN without a parent id.
This commit is contained in:
commit
458064ddde
1 changed files with 12 additions and 5 deletions
|
@ -119,8 +119,10 @@ 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"]);
|
||||||
|
if (isset($entry)) {
|
||||||
$root->appendChild($entry);
|
$root->appendChild($entry);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return trim($doc->saveXML());
|
return trim($doc->saveXML());
|
||||||
}
|
}
|
||||||
|
@ -323,8 +325,10 @@ class DFRN
|
||||||
}
|
}
|
||||||
|
|
||||||
$entry = self::entry($doc, $type, $item, $owner, true);
|
$entry = self::entry($doc, $type, $item, $owner, true);
|
||||||
|
if (isset($entry)) {
|
||||||
$root->appendChild($entry);
|
$root->appendChild($entry);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$atom = trim($doc->saveXML());
|
$atom = trim($doc->saveXML());
|
||||||
|
|
||||||
|
@ -390,8 +394,10 @@ 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);
|
||||||
|
if (isset($entry)) {
|
||||||
$root->appendChild($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);
|
||||||
}
|
}
|
||||||
|
@ -906,7 +912,7 @@ class DFRN
|
||||||
* @param int $cid Contact ID of the recipient
|
* @param int $cid Contact ID of the recipient
|
||||||
* @param bool $single If set, the entry is created as an XML document with a single "entry" element
|
* @param bool $single If set, the entry is created as an XML document with a single "entry" element
|
||||||
*
|
*
|
||||||
* @return \DOMElement XML entry object
|
* @return null|\DOMElement XML entry object
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
* @throws \ImagickException
|
* @throws \ImagickException
|
||||||
* @todo Find proper type-hints
|
* @todo Find proper type-hints
|
||||||
|
@ -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']) {
|
||||||
|
|
Loading…
Reference in a new issue