1
0
Fork 0

Merge pull request #10305 from annando/warnings

Fix warning "reset() expects parameter 1 to be array, null given"
This commit is contained in:
Tobias Diekershoff 2021-05-23 18:43:18 +02:00 committed by GitHub
commit 280d0ee961
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;