Skip to content

$results['errors'] is object not an array #8

Description

@olliecamp

Original code:
if (!isset($result['errors'])) {

Result:
Fatal error: Cannot use object of type stdClass as array in _Somefilepath_\StormTwitter.class.php on line 155

Correcting code to:
if (!isset($result->errors)) {

Result:
This is a var_dump of the resulting array which is as expected.
array(1) { ["error"]=> string(115) "Something went wrong with the twitter request: {"errors":[{"message":"Sorry, that page does not exist","code":34}]}" }.

It seems that for some reason the results array has become an object. Correcting this solves the issue.

Not sure if this is a global wp thing or just a quirk on my install.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions