Geocoder requests includes the parameter options=null

Created on 15 November 2020, about 4 years ago
Updated 25 February 2023, almost 2 years ago

Problem/Motivation

If the map geocoder settings options are '' (default not set) the request from the geocode map 'field' to geocode is encoded as:-

http://example.com/geocoder/api/geocode?address=What%20has%20%been%20typ...

The null is being treated as the string 'null' by geocoder Drupal\geocoder\Controller\GeocoderApiEnpoints::setGeocodersOptions() which is then passed into NestedArray::mergeDeep causing it to throw an exception as it's getting the string 'null' as one of the arrays to iterate over.

Steps to reproduce

Create a geocoder configuration with the default options ''. Configure geofield to use geomap with the geocoder. With exceptions switched to be outputted the exception will be at the top of the json response from the geocoder.

Proposed resolution

Maybe not the best place, but I just in the GeocoderService::getJsGeocoderSettings switched to the empty string '' if Json::decode($map_geocoder_settings['options']) returned null.

Remaining tasks

Post patch, review.

User interface changes

n/a

API changes

n/a

Data model changes

n/a

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇳🇱Netherlands ekes

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024