Problem/Motivation
After updating the geofield module from 1.22.0 to 1.32.0 I'm getting the following notice. I'm on drupal core 8.9.16.
Notice: Undefined index: lat in Drupal\geofield\Plugin\GeofieldProximitySourceBase->getHaversineOptions()
Steps to reproduce
On my site this notice is appearing wherever geofield is being used.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | geofield_getHaversineOptions_3223984_2.patch | 925 bytes | itamair |
Comments
Comment #2
itamair commentedThanks for reporting this @jor_kai.
Does the attached patch solve your issue?
Please test and deep review ....
Comment #3
itamair commentedComment #5
itamair commentedCommitted into dev, will be part of the next Geofield release.
Comment #6
jor_kai commentedHi itamair, thanks for you work on this module and your quick response. Also apologies for my delayed response. I've applied you patch and am no longer receiving the notice.
Comment #7
jor_kai commentedI've noticed an issue after applying the patch. I'm now getting a drupal system message that says "An illegal choice has been detected. Contact the site administrator".
When I check status logs I see the following error.
Drupal\geofield\Exception\HaversineUnavailableException: Not able to calculate Haversine Options due to invalid Proximity origin location. in Drupal\geofield\Plugin\GeofieldProximitySourceBase->getHaversineOptions() (line 176 of /var/www/html/projects/websites/memorialcare.org/www-jordan/modules/contrib/geofield/src/Plugin/GeofieldProximitySourceBase.php).
Comment #8
jor_kai commentedSetting the status back to "Needs Work". I think that is the correct status because of my issue above.
Comment #9
jor_kai commentedSorry for the back and forth. Looking at this closer the issues I reported above appear to be coming from my own code. Setting the status back to fixed.
Comment #12
itamair commentedThanks @jor_kai ... but we still have an issue here.
The Drupal\geofield\Exception\HaversineUnavailableException shouldn't be thrown for an invalid Origin Lat/Lon pair definition.
The last commit fixes better all this and I am going to deploy a new 8.x-1.34 release.
Comment #13
jor_kai commentedThanks @itamair, I've updated to 8.x-1.34 and everything is working great for me.