]> git.mxchange.org Git - friendica.git/commitdiff
AP: Fix a notice / avoid an error when fetched content hadn't been an array
authorMichael <heluecht@pirati.ca>
Thu, 18 Oct 2018 05:54:44 +0000 (05:54 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 18 Oct 2018 05:54:44 +0000 (05:54 +0000)
src/Protocol/ActivityPub.php
src/Protocol/ActivityPub/Processor.php

index 0af8ee5e3545a157c96178eeb8455150eadefe10..23eb861721279a4a66a454306696d7b0c0342ddc 100644 (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;
        }
 
        /**
index c481423a675c495349ad2d27c7d56f8009cbd5a9..9bafb5e17511cc10c2a35565b2003f78e9aff2f1 100644 (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);