- 🇺🇦Ukraine SVICER Mirgorod
Reproduced on clear drupal 10 standart instalation.
Enviroment: php8.1 and php8.2
Drupal 10.0.9
Drush 11.5.1
drupal/geolocation 3.12.0Steps to reproduce:
- Install standart Drupal profile
- Enable geolocation module
- Add geolocation field to Article
- Try to create new Article and fill Latitude and Longitude with random string
- Click to Save button
- You will see 500 error on page and in logsThe website encountered an unexpected error. Please try again later. TypeError: deg2rad(): Argument #1 ($num) must be of type float, string given in deg2rad()
- Status changed to Needs work
over 1 year ago 10:52am 11 May 2023 - Status changed to Closed: cannot reproduce
over 1 year ago 8:55am 30 May 2023 - 🇩🇪Germany christianadamski Berlin, Germany
- went to simplytest.me
- chose Geolocation 8.x-3.x-dev
- waited for ready
- added geolocation field to article
- went to create new article
- added random letters to lat / lng
- got a correct warning (see screenshot)Unless you can provide a way to reproduce your issue, I really can't do anything.
- 🇺🇦Ukraine SVICER Mirgorod
I think this problem cannot be reproduced on simplytest.me because this test tool uses PHP 7.4. But this problem is reproduced on PHP 8.1 and PHP 8.2
- Status changed to Needs work
about 1 year ago 8:34am 30 October 2023 - 🇧🇪Belgium dtfabio Ninove
Hi ChristianAdamski,
I also had the same problem on one of our sites using this module.
Drupal version: 10.1.5
PHP version: 8.1.11
Module version: 3.12.0I got the error after entering a float with a comma as a separator instead of a full stop.
These values (Latitude : 29,9773, Longitude : 31,1325)
Gave the following error (see image):
Only there was a peculiarity, while creating my content the error did happen, but while editing I got the message (NaN) on the field after entering the values. (So after entering it correctly once, it doesn't seem to occur again.)
So validation did happen, but just not during initeal adding of the content?
The patch fixed the problem for me and the field still works. The only thing I am still somewhat unsure about is the message displayed.
In Belgium, this is a valid number (as we work with commas). So perhaps a conversion to full stop in the code or a mention under the field that a full stop is required would be useful, I think?
Just to be sure, I also tried your simplytest.me way, only with the difference that I used the latest release instead of the dev branch.
This is the test site status page.
Perhaps using the release version and not the dev branch caused the PHP version to be chosen correctly. Because in my instance, the site is PHP 8.1.
I fill in the fields with the test values listed above.
After which I am shown the following error on the page and the logs show the same error as on our production site.
I hope this is enough information to take a closer look at this ticket, so that this solution (possibly with a few more tweaks) can be included in to the module.
Greetings,
Fabio
- 🇮🇳India jagraj_singh_gill
I was facing similar issue with version 8.x-3.12 when I was adding any string in the Lat/Long fields as soon as focus was going out of field input, it was changing to NaN.
In code, parent set value was being called before the custom code execution. After changing the order of execution it started working for me. I have attached my patch below. - Status changed to Needs review
11 months ago 11:22am 2 January 2024 - last update
11 months ago 32 pass, 1 fail The last submitted patch, 14: geolocation-3257751-14.patch, failed testing. View results →
- 🇮🇳India jagraj_singh_gill
Just to provide more context on above issue, I am only able to reproduce this issue when I use Geolocation Google Maps API - Geocoding and Map in Form display of this Geolocation field.
- 🇪🇸Spain eduardo morales alberti Spain, 🇪🇺
Created constraint validation on issue https://www.drupal.org/project/geolocation/issues/3236557 📌 Add long / lat range & type validation helper Needs review
- last update
9 months ago 32 pass, 1 fail - 🇩🇪Germany christianadamski Berlin, Germany
This is not reproducible on simplytest.me in v3, not v4.