From 4ac68394c358f4a33fc42a5fa345a98ca69e55d5 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 23 May 2021 16:37:34 +0000 Subject: [PATCH] Fix warning "reset() expects parameter 1 to be array, null given" --- src/Object/Api/Mastodon/Status.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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;