-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1714404
commit 82bb62d
Showing
1 changed file
with
4 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82bb62d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you have a bug here
json_decode will return object, not array (until you set true as second param)
if (!isset($body["order"])) - this will fails with error
Cannot use object of type stdClass as array
btw, array_key_exists will work on object, but will return null without error
82bb62d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
array_key_exists on object in PHP 7.4 will produce:
(E_DEPRECATED)
array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead
Problem: setting true as second parameter causes a problem in PHP 7.4:
Trying to get property 'order' of non-object:
$body->{'order'} reading object
$body["order"] reading array
can you please use array or object syntax, but not both
thank you