From: Mikael Nordfeldth Date: Mon, 10 Jul 2017 12:26:01 +0000 (+0200) Subject: Force arrays in constructors of ActivityStreamJSONDocument and JSONActivityCollection X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a7df79ac073d3d6dad13cc0fa3cd1224c9bde933;p=quix0rs-gnu-social.git Force arrays in constructors of ActivityStreamJSONDocument and JSONActivityCollection Started using PHP7+ and it started complaining about count() being fed objects that weren't "Countable". .) --- 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);