Title: Cannot use object of type stdClass as array
Last modified: August 20, 2016

---

# Cannot use object of type stdClass as array

 *  [Ximousse](https://wordpress.org/support/users/ximousse/)
 * (@ximousse)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/cannot-use-object-of-type-stdclass-as-array/)
 * 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/](http://wordpress.org/extend/plugins/twitter-like-box-reloaded/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Damian](https://wordpress.org/support/users/timersys/)
 * (@timersys)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/cannot-use-object-of-type-stdclass-as-array/#post-3278592)
 * Thanks i will review the issue
 *  Thread Starter [Ximousse](https://wordpress.org/support/users/ximousse/)
 * (@ximousse)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/cannot-use-object-of-type-stdclass-as-array/#post-3278593)
 * 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 !
 *  Plugin Author [Damian](https://wordpress.org/support/users/timersys/)
 * (@timersys)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/cannot-use-object-of-type-stdclass-as-array/#post-3278601)
 * 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
 *  Thread Starter [Ximousse](https://wordpress.org/support/users/ximousse/)
 * (@ximousse)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/cannot-use-object-of-type-stdclass-as-array/#post-3278602)
 * 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.
 *  Plugin Author [Damian](https://wordpress.org/support/users/timersys/)
 * (@timersys)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/cannot-use-object-of-type-stdclass-as-array/#post-3278603)
 * Really strange … i testes transients and works fine on my end. What could affect
   them? a db cache plugin ?

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Cannot use object of type stdClass as array’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/twitter-like-box-reloaded.svg)
 * [Twitter Like Box - Like facebook box but for twitter](https://wordpress.org/plugins/twitter-like-box-reloaded/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/twitter-like-box-reloaded/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/twitter-like-box-reloaded/)
 * [Active Topics](https://wordpress.org/support/plugin/twitter-like-box-reloaded/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/twitter-like-box-reloaded/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/twitter-like-box-reloaded/reviews/)

## Tags

 * [json_decode](https://wordpress.org/support/topic-tag/json_decode/)
 * [stdClass](https://wordpress.org/support/topic-tag/stdclass/)

 * 5 replies
 * 2 participants
 * Last reply from: [Damian](https://wordpress.org/support/users/timersys/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/cannot-use-object-of-type-stdclass-as-array/#post-3278603)
 * Status: not resolved