From a7df79ac073d3d6dad13cc0fa3cd1224c9bde933 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 10 Jul 2017 14:26:01 +0200 Subject: [PATCH] Force arrays in constructors of ActivityStreamJSONDocument and JSONActivityCollection Started using PHP7+ and it started complaining about count() being fed objects that weren't "Countable". .) --- lib/activitystreamjsondocument.php | 7 ++----- lib/jsonactivitycollection.php | 3 ++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/activitystreamjsondocument.php b/lib/activitystreamjsondocument.php index 12c3882c25..11b4e51ec8 100644 --- a/lib/activitystreamjsondocument.php +++ b/lib/activitystreamjsondocument.php @@ -27,10 +27,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET')) -{ - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } /** * A class for generating JSON documents that represent an Activity Streams @@ -72,7 +69,7 @@ class ActivityStreamJSONDocument extends JSONActivityCollection * @param User $cur the current authenticated user */ - function __construct($cur = null, $title = null, $items = null, $links = null, $url = null) + function __construct($cur = null, $title = null, array $items=[], $links = null, $url = null) { parent::__construct($items, $url); diff --git a/lib/jsonactivitycollection.php b/lib/jsonactivitycollection.php index 1d1b482e04..1e4f181ffa 100644 --- a/lib/jsonactivitycollection.php +++ b/lib/jsonactivitycollection.php @@ -1,4 +1,5 @@ items = empty($items) ? array() : $items; $this->totalItems = count($items); -- 2.39.5