WordPress.org

Ready to get started?Download WordPress

Forums

Twitter Like Box - Like facebook box but for twitter
Cannot use object of type stdClass as array (6 posts)

  1. Ximousse
    Member
    Posted 1 year ago #

    I sometimes get this message (and sometimes don't, don't know why), I forced json_decode to return an array on line 287, replaced :
    $json = json_decode(wp_remote_retrieve_body($response));
    by
    $json = json_decode(wp_remote_retrieve_body($response),true);
    Haven't had a problem since.

    http://wordpress.org/extend/plugins/twitter-like-box-reloaded/

  2. Damian
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks i will review the issue

  3. Ximousse
    Member
    Posted 1 year ago #

    Actually, it's a bit more complicated than I thought. The problem comes (also) from Twitter and the limit of requests per hour (150) and for a reason I ignore the transient doesn't work properly. I'll keep you posted as soon as I find a workaround.
    Thanks for this great plugin by the way !

  4. Damian
    Member
    Plugin Author

    Posted 1 year ago #

    Hi, im investigating this issue now, sorry for the delay. Can you give me more details like where you get that error?

    Actually $json was an array with an object inside, but now just in case i forced everything to be arrays. I can't reproduce your error so im not sure if its a PHP version problem. Wich PHP version do yo have?

    Try to download the new version that will be released in the next hour

  5. Ximousse
    Member
    Posted 1 year ago #

    Hi,
    Actually the problem, I think, comes from WordPress transients.

    The content of $json wasn't the expected array so I checked what was in it: something like "Unauthenticated calls are permitted 150 requests per hour."

    But from what I read in your code, there shouldn't be more than one call every 3 hours so I monitored the calls :
    - first call of fetch_twitter_followers : OK
    - next call, three hours after : OK
    - then.... 560 calls in 50 minutes
    - next call, three hours after : OK
    - etc
    (the module is on a quite visited website)
    I've just started investigating so I haven't much to tell you for the moment.

  6. Damian
    Member
    Plugin Author

    Posted 1 year ago #

    Really strange ... i testes transients and works fine on my end. What could affect them? a db cache plugin ?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic