This repository was archived by the owner on Jan 13, 2022. It is now read-only.
Fix "Fatal error: Cannot use object of type stdClass as array" errors #177
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When an embed object returned which has no own GraphObject subclass the resulting GraphObject instance recieves an stdClass for backingData which is wrong since the getProperty method expects it to be an array.
Example:
The reason behind this error is this is in the
__construct
ofGraphObject
.The code tries to detect if it got an
\stdClass
and do converts it to an array if it's the top level data it received, but then goes to check for adata
key and there is no conversion for that value.The proposed change make everything received from the grap api in json, to be converted into arrays instead of
\stdClass
regardless of nesting so you I think you can delete the explicit check and conversion too in the__construct
ofGraphObject