From: Michael Date: Sun, 23 May 2021 16:37:34 +0000 (+0000) Subject: Fix warning "reset() expects parameter 1 to be array, null given" X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4ac68394c358f4a33fc42a5fa345a98ca69e55d5;p=friendica.git Fix warning "reset() expects parameter 1 to be array, null given" --- diff --git a/src/Object/Api/Mastodon/Status.php b/src/Object/Api/Mastodon/Status.php index eb88ce5f1a..974ac0dc74 100644 --- a/src/Object/Api/Mastodon/Status.php +++ b/src/Object/Api/Mastodon/Status.php @@ -114,8 +114,12 @@ class Status extends BaseDataTransferObject $this->visibility = $visibility[$item['private']]; $languages = json_decode($item['language'], true); - reset($languages); - $this->language = is_array($languages) ? key($languages) : null; + if (is_array($languages)) { + reset($languages); + $this->language = key($languages); + } else { + $this->language = null; + } $this->uri = $item['uri']; $this->url = $item['plink'] ?? null;