PHP Notices
-
Hi,
Your plugin throws some PHP notices that need to be addressed when OSM address cannot be geocoded (for whatever reason) …
[16-Dec-2022 07:38:10 UTC] PHP Notice: Undefined offset: 0 in /wp-content/plugins/leaflet-map/class.geocoder.php on line 171 [16-Dec-2022 07:38:10 UTC] PHP Notice: Trying to get property 'lat' of non-object in /wp-content/plugins/leaflet-map/class.geocoder.php on line 171 [16-Dec-2022 07:38:10 UTC] PHP Notice: Undefined offset: 0 in /wp-content/plugins/leaflet-map/class.geocoder.php on line 172 [16-Dec-2022 07:38:10 UTC] PHP Notice: Trying to get property 'lon' of non-object in /wp-content/plugins/leaflet-map/class.geocoder.php on line 172They can be resolved by changing the code at line 170 of /class.geocoder.php from …
return (Object) array( 'lat' => $json[0]->lat, 'lng' => $json[0]->lon, );… to …
if (isset($json[0]->lat) && isset($json[0]->lon)) { return (Object) array( 'lat' => $json[0]->lat, 'lng' => $json[0]->lon, ); } else { throw new Exception('No Address Found.'); return false; }Oliver
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘PHP Notices’ is closed to new replies.