Title: Bug in get_google_components
Last modified: December 29, 2020

---

# Bug in get_google_components

 *  Resolved [guusifs](https://wordpress.org/support/users/guusifs/)
 * (@guusifs)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/bug-in-get_google_components/)
 * In the method get_google_components in the class ES_Address_Components there 
   is a bug.
 * The WordPress function wp_safe_remote_get can return an object of the class WP_Error
   and the following code does not check properly if either an array or an object
   of WP_Error is being returned.
 * Original code:
 * if ( ! empty( $url ) ) {
    $res = wp_safe_remote_get( $url ); return json_decode(!
   empty( $res[‘body’] ) ? $res[‘body’] : array() ); }
 * Suggested code:
 * if ( ! empty( $url ) ) {
    $res = wp_safe_remote_get( $url ); if (get_class($res)!
   =’WP_Error’) { // or (gettype($res)==’array’) (maybe safer even) return json_decode(!
   empty($res[‘body’])?$res[‘body’]:array()); } else { return false; // or return
   null } }

Viewing 1 replies (of 1 total)

 *  Plugin Author [Estatik](https://wordpress.org/support/users/estatik/)
 * (@estatik)
 * [5 years, 5 months ago](https://wordpress.org/support/topic/bug-in-get_google_components/#post-13848833)
 * Hi there,
 * It looks like you’re using an outdated version of the plugin. Our developers 
   claim that this bug has been fixed for a long time. Please try updating the plugin.
   
   [http://joxi.net/RmzYWpPcMd78kr](http://joxi.net/RmzYWpPcMd78kr)
 * And thank you for your feedback.
    Merry Christmas and Happy New Year!

Viewing 1 replies (of 1 total)

The topic ‘Bug in get_google_components’ is closed to new replies.

 * ![](https://ps.w.org/estatik/assets/icon-256x256.png?rev=2819514)
 * [Estatik Real Estate Plugin](https://wordpress.org/plugins/estatik/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/estatik/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/estatik/)
 * [Active Topics](https://wordpress.org/support/plugin/estatik/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/estatik/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/estatik/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Estatik](https://wordpress.org/support/users/estatik/)
 * Last activity: [5 years, 5 months ago](https://wordpress.org/support/topic/bug-in-get_google_components/#post-13848833)
 * Status: resolved