• Please see my other note where I acknowledge that at this point I know I have an invalid provider API key. But I don’t think that’s what causes this error…

    With WP_DEBUG true, I get the Debug tab in Settings. I enter a Lookup By Address and click Lookup.
    The response is the following:

    Notice:  Undefined offset: 0 in .../simple-location/includes/class-geo-data.php on line 1253
    Notice:  Undefined offset: 0 in .../simple-location/includes/class-geo-data.php on line 1253
    {"latitude":"33.9999","longitude":"-117.9999"}

    So, the address is processed, and there is a response without an error.
    The geocoding provider selected is OpenStreetMap Nominatim.

    On using Google (for which I have a bad API key), both class-geo-data.php and class-geo-provider-google.php report variable undefined issues because the JSON is not as expected:
    {"display-name":""}

    Bing of course returns an error too. That’s my issue:
    {"code":"missing_api_key","message":"You have not set an API key for Bing","data":null}
    And at class-geo-data.php line 1253 there are the same two “offset 0” errors.

    As in my other note here, I recommend checking the response for validity before continuing through the parsing process.

    Thanks!

Viewing 1 replies (of 1 total)
  • Thread Starter Tony G

    (@starbuck)

    Follow-up: Using the Google provider with a valid key, I can enter different close Lat/Lon values, and the lookup returns a good Zone name that was created with a 10m radius, and no errors. As your documentation says, if a request is within a zone, the zone name will be returned – so this is working correctly.

    It’s only the address lookup that’s choking with undefined fields. The JSON response from Google looks good. As you noted in your response, this is probably just an API version issue with the fieldnames.

    I’m just providing this here to provide a more complete picture.

    No response requested.

Viewing 1 replies (of 1 total)
  • The topic ‘Undefined offset in Debug Location Lookup’ is closed to new replies.