Fix Fatal errors in Protocol\OStatus (#5466)

This commit is contained in:
Hypolite Petovan 2018-07-23 07:48:44 -04:00 committed by GitHub
parent 53876abfda
commit b685ef37c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -288,7 +288,7 @@ class OStatus
* @param string $hub Called by reference, returns the fetched hub data * @param string $hub Called by reference, returns the fetched hub data
* @return void * @return void
*/ */
public static function import($xml, array $importer, array &$contact, &$hub) public static function import($xml, array $importer, array &$contact = null, &$hub)
{ {
self::process($xml, $importer, $contact, $hub); self::process($xml, $importer, $contact, $hub);
} }
@ -1704,6 +1704,10 @@ class OStatus
$parent = Item::selectFirst([], ['uri' => $item["thr-parent"], 'uid' => $item["uid"]]); $parent = Item::selectFirst([], ['uri' => $item["thr-parent"], 'uid' => $item["uid"]]);
if (!$parent) {
$parent = [];
}
XML::addElement($doc, $as_object, "activity:object-type", self::constructObjecttype($parent)); XML::addElement($doc, $as_object, "activity:object-type", self::constructObjecttype($parent));
self::entryContent($doc, $as_object, $parent, $owner, "New entry"); self::entryContent($doc, $as_object, $parent, $owner, "New entry");