Skip to content
This repository was archived by the owner on Jan 5, 2023. It is now read-only.

Commit 0cdba84

Browse files
p-blombergahsankhatri
authored andcommitted
Fix crash when trying to read empty array (#4)
* Fix crash when trying to read empty array
1 parent ecdd92b commit 0cdba84

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/FirestoreDocument.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,10 @@ public function getArray($value)
192192
{
193193
$results = [];
194194

195-
foreach ($value['arrayValue']['values'] as $key => $value) {
196-
$results[$key] = $this->castValue($value);
195+
if (isset($value['arrayValue']['values']) && is_array($value['arrayValue']['values'])) {
196+
foreach ($value['arrayValue']['values'] as $key => $value) {
197+
$results[$key] = $this->castValue($value);
198+
}
197199
}
198200

199201
return $results;

0 commit comments

Comments
 (0)