Problem/Motivation
Site crashes, getting this error in the logs:
TypeError : Argument 1 passed to Drupal\geofield_map\Services\MarkerIconService::getIconFileManagedElement() must be of the type int, null given, called in /var/www/html/web/modules/contrib/geofield_map/src/Plugin/Field/FieldFormatter/GeofieldGoogleMapFormatter.php on line 342
Here is the code failing:
'icon_file' => $this->markerIcon->getIconFileManagedElement($fid),
Actually the parameter $fid is initialized to NULL if not found:
$fid = (integer) !empty($settings['map_marker_and_infowindow']['icon_file_wrapper']['icon_file']['fids']) ? $settings['map_marker_and_infowindow']['icon_file_wrapper']['icon_file']['fids'] : NULL;
Looks like some better error handling is needed here.
Steps to reproduce
Not sure how to reproduce it.
Proposed resolution
Set icon file to NULL if $fid is NULL? At least it doesn't crash anymore.
Comments
Comment #3
itamair commentedNew 8.x-2.82 release should have fixed this ... please test and review and provide feedback here.
Comment #4
mably commentedCan confirm that the problem has been fixed with release 2.82.
Thanks for the quick fix!
Comment #5
itamair commentedthanks for reporting this @mably, you are welcome
Comment #6
desierto commentedI presume this must be related. I upgraded to 2.84 from 2.80 and thereafter got this error (and the page failing to load) every time I visit a page with a GeoField map. I downgraded to 8.82, but the error persists... downgraded to 2.80 and it goes away.
TypeError: Argument 8 passed to Drupal\geofield_map\Services\MarkerIconService::__construct() must implement interface Drupal\Core\File\FileUrlGeneratorInterface, instance of Drupal\redirect_404\Render\Redirect404LogSuppressor given, called in /www/wildsonora/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 262 in Drupal\geofield_map\Services\MarkerIconService->__construct() (line 240 of /www/wildsonora/web/modules/contrib/geofield_map/src/Services/MarkerIconService.php)Comment #7
itamair commented@desierto it looks to me that you simply forgot to clear the drupal cache after upgrading your geofield_map module.
Don't forget to always do that.
I would bet it would solve also this issue of you ...
Comment #8
desierto commented@itamair, thank you for the suggestion... I upgraded just now and it went straight to today's latest 2.85 release. I cleared the cache and it did fix my issue. I think many modules when updated call for an /update.php cache clear, if needed. Thanks... I appreciate the help.