AP: Fix a notice / avoid an error when fetched content hadn't been an array

This commit is contained in:
Michael 2018-10-18 05:54:44 +00:00
parent da2a17495d
commit 8035bad8e2
2 changed files with 8 additions and 2 deletions

View file

@ -63,7 +63,13 @@ class ActivityPub
return false;
}
return json_decode($curlResult->getBody(), true);
$content = json_decode($curlResult->getBody(), true);
if (empty($content) || !is_array($content)) {
return false;
}
return $content;
}
/**

View file

@ -272,7 +272,7 @@ class Processor
$activity['cc'] = defaults($object, 'cc', []);
$activity['actor'] = $child['author'];
$activity['object'] = $object;
$activity['published'] = $object['published'];
$activity['published'] = defaults($object, 'published', $child['published']);
$activity['type'] = 'Create';
$ldactivity = JsonLD::compact($activity);