Undefined offset in Debug Location Lookup
-
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
andclass-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 atclass-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!
- The topic ‘Undefined offset in Debug Location Lookup’ is closed to new replies.