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

Commit 0b7d22f

Browse files
author
dudu
committed
Fix "Fatal error: Cannot use object of type stdClass as array"
Make sure that the "backingData" property's value will always be converted to an array.
1 parent ebde5ad commit 0b7d22f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Facebook/GraphObject.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ public function __construct($raw)
5050
$this->backingData = $raw;
5151

5252
if (isset($this->backingData['data']) && count($this->backingData) === 1) {
53-
$this->backingData = $this->backingData['data'];
53+
if ($this->backingData['data'] instanceof \stdClass) {
54+
$this->backingData = get_object_vars($this->backingData['data']);
55+
} else {
56+
$this->backingData = $this->backingData['data'];
57+
}
5458
}
5559
}
5660

0 commit comments

Comments
 (0)