Open olafgrabienski opened 7 months ago
Some more observations:
As far as I know, the error happens with PHP 8.2 but not with PHP 8.1.
Also, there is a workaround: Add a 'Geofield:lat (not empty)' filter to the view.
Finally, the issue seems to be fixed when I change line 234 in geofield.elements.inc
from:
if (!empty($element['origin']['#value']) && trim($element['origin']['#value']) != '' && empty($element['distance']['#value']))
to:
if (!empty($element['origin']['#value']) && is_string($element['origin']['#value']) && trim($element['origin']['#value']) != '' && empty($element['distance']['#value']))
(I found a file with this patch in an older test site. Unfortunately, I don't recall from where I got it.)
Some more digging: I never saw that error, but my setup is different: no Address field, not using Google API, no automatic geocoding from field. (Still PHP 8.2)
Hope this helps to narrow things down a bit.
@olafgrabienski you could do a little more debugging, I guess.
When the field value's empty, $element['origin']['#value']
doesn't seem to be empty (first condition), and it's an array... what is it then?
Can you put in a:
debug($element['origin']['#value']);
right before that breaking line and check what the value is? Either directly on page (when error display's on), or in dblog if not.
Not on a production site, of course.
Thanks for your feedback, @indigoxela! Interestingly, I'm not able to reproduce the error at the moment, even though I have removed both the patch and the 'Geofield:lat (not empty)' views filter (and cleared caches several times). Hm ..., when I tested this some months ago, I also started with this very issue and ended up with a working site, and I wasn't sure what exactly fixed it. And now again, as the issue seems to be fixed somehow, I don't know how to reproduce it.
That said, I put however the debug code before the line in question, getting the following message in DBlog.
User notice: false in geofield_proximity_search_validate() (line 324 of .../modules/geofield/geofield.elements.inc).
Not sure if this is still relevant, though.
User notice: false...
In this case the first condition works, so you don't even get to the "trim()".
And now again, as the issue seems to be fixed somehow...
A Heisenbug - they're the worst. :speak_no_evil:
Your initial report indicates, that this value can be a non-empty array under circumstances... But without steps to reproduce, I guess we're stuck ATM. :shrug: Anyway, the issue exists now and maybe someone comes up with a clue. Maybe some "hickup" when geocoding the address? Not sure. I usually avoid automatic geocoding of address fields - had all sorts of trouble with that in D7.
When I set up a content view with Geofield data, I get the following error:
Steps to reproduce
Actual behavior: The view doesn't show anything. In DBlog, you see the error message from above.
Expected behavior: The view works, and you can filter the locations by proximity.
Additional information