Force arrays in constructors of ActivityStreamJSONDocument and JSONActivityCollection
Started using PHP7+ and it started complaining about count() being fed objects that weren't "Countable". .)
This commit is contained in:
parent
31866be98b
commit
a7df79ac07
|
@ -27,10 +27,7 @@
|
||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET'))
|
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||||
{
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class for generating JSON documents that represent an Activity Streams
|
* 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
|
* @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);
|
parent::__construct($items, $url);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Collection primarily as the root of an Activity Streams doc but can be used as the value
|
* Collection primarily as the root of an Activity Streams doc but can be used as the value
|
||||||
|
@ -24,7 +25,7 @@ class JSONActivityCollection {
|
||||||
* @param string $url url of a doc list all the objs in the collection
|
* @param string $url url of a doc list all the objs in the collection
|
||||||
* @param int $totalItems total number of items in the collection
|
* @param int $totalItems total number of items in the collection
|
||||||
*/
|
*/
|
||||||
function __construct($items = null, $url = null)
|
function __construct(array $items=[], $url = null)
|
||||||
{
|
{
|
||||||
$this->items = empty($items) ? array() : $items;
|
$this->items = empty($items) ? array() : $items;
|
||||||
$this->totalItems = count($items);
|
$this->totalItems = count($items);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user