• Resolved guusifs

    (@guusifs)


    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

    (@estatik)

    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

    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.