Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've installed Geofield and GeoPHP modules and I'm getting this error after I have save added the Geofield to my content type. I get the following error.
Warning: call_user_func_array() expects parameter 1 to be a valid callback, class '\geoPHP' not found in Drupal\geofield\GeoPHP\GeoPHPWrapper->load() (line 18 of modules\geofield\src\GeoPHP\GeoPHPWrapper.php).
Drupal\geofield\GeoPHP\GeoPHPWrapper->load('POINT (7.1101 52.2593)') (Line: 206)
Drupal\geofield\Plugin\Field\FieldType\GeofieldItem->populateComputedValues() (Line: 199)
Drupal\geofield\Plugin\Field\FieldType\GeofieldItem->setValue(Array, ) (Line: 69)
Drupal\Core\TypedData\Plugin\DataType\ItemList->setValue(Array, 1) (Line: 118)
Drupal\Core\Field\FieldItemList->setValue(Array) (Line: 373)
Drupal\Core\Field\WidgetBase->extractFormValues(Object, Array, Object) (Line: 222)
Drupal\Core\Entity\Entity\EntityFormDisplay->extractFormValues(Object, Array, Object) (Line: 223)
Drupal\Core\Entity\ContentEntityForm->copyFormValuesToEntity(Object, Array, Object) (Line: 291)
Drupal\Core\Entity\EntityForm->buildEntity(Array, Object) (Line: 74)
Drupal\Core\Entity\ContentEntityForm->buildEntity(Array, Object) (Line: 94)
Drupal\Core\Entity\ContentEntityForm->validateForm(Array, Object)
call_user_func_array(Array, Array) (Line: 83)
Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object) (Line: 270)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object, 'node_place_form') (Line: 119)
Drupal\Core\Form\FormValidator->validateForm('node_place_form', Array, Object) (Line: 569)
Drupal\Core\Form\FormBuilder->processForm('node_place_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('node_place_form', Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object) (Line: 113)
Drupal\node\Controller\NodeController->add(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 139)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 62)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 98)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 77)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 628)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Any ideas?
Thanks
Comments
Comment #2
darren.fisher CreditAttribution: darren.fisher commentedHi,
We're experiencing this exact same issue. @Raher did you manage to resolve this?
Regards,
Darren.
Comment #3
Ewout GoosmannHello,
We are also encountered this warning. Is there already a solution?
Comment #4
texas-bronius CreditAttribution: texas-bronius commentedI don't know either, but I'm wondering if someone can confirm that it /should/ work and whether it's one of these "composer issues" and how the module is supposed to be installed?
Comment #5
gdelver@xs4all.nl CreditAttribution: gdelver@xs4all.nl as a volunteer commented@texas-bronius: #4: FYI: I got the following stack working in 8.1.x with composer commands:
you need a google map key ...
I am now in the process of testing geolocation which works fine too...
cheers, Guido
Comment #6
texas-bronius CreditAttribution: texas-bronius commentedThanks Guido - You beat me to it (and provided a way better response than I would have). But did you not need
composer require "phayes/geophp"
? That's what did the trick for me..Comment #7
gdelver@xs4all.nl CreditAttribution: gdelver@xs4all.nl as a volunteer commented@texas-bronius #6,
It was loaded by composer, look at the difference in versions:I use:
composer require drupal/geofield 1.0-alpha2
see also documentation in the beginning of https://www.drupal.org/project/geofield on drupal 8 and geophp dependency
and ... you need a google map key ...!
have fun ;-), Guido
Comment #8
NicolasH CreditAttribution: NicolasH commentedI'm still getting this in alpha4.
Comment #9
bronk CreditAttribution: bronk commentedAlso still getting this in the alpha. Why is it trying to load the geoPHP class if it's not relying on it anymore?
Comment #10
rmcdahal CreditAttribution: rmcdahal commentedI am thinking Why i have choose this module over geolocation module.. Opened issue no response,no fix..
Comment #11
imclean CreditAttribution: imclean commented@bronk geoPHP is the library https://github.com/phayes/geoPHP . The module GeoPHP provides Drupal integration with the library. This can get a bit confusing when using the Geocoder module. #2925674: Geocoder and GeoPHP modules
Comment #12
Mile23This happens because phayes/geoPHP does not (correctly) specify how to autoload classes in its composer.json file.
There are a bunch of issues and PRs for that project about this, but I like mine the best: https://github.com/phayes/geoPHP/pull/147
Comment #13
itamair CreditAttribution: itamair as a volunteer commentedThe Geofield Module for Drupal 8 is NOT depending from the Drupal GeoPHP module anymore
but directly REQUIRE the GeoPHP library.
The correct method is to install the Geofield module via composer:
composer require drupal/geofield
that (if your root composer.json is properly setup for your D8 installation) will correctly download the geoPHP too, in the vendor/phayes/geophp folder
Otherwise you will need to run (anyway, at least):
composer require phayes/geophp
to fix this issue, as stated in the #6
Comment #14
Mile23I've done all that and I still get this when I try to save a new field:
This is on Pantheon.
Here's what it looks like locally for my site:
Comment #15
itamair CreditAttribution: itamair as a volunteer commented@Mile23 it would probably depend on where your "composer require phayes/geophp" is installing and looking for the geophp library.
It seems it is searching it in a very pantheon env specific location, and might depend on the proper way pantheon is asking you to add D8 modules/requirements, and its composer.json.
In any of the standard D8 ways to install D8 with composer (Option A, B, or C) each of the following commands:
would create this folder: /vendor/phayes/geophp
and the autoload should be able to find the proper geophp files/classes, when called from the geofield module, and that's it.
Some matter on your specific dev env and/or way to install otherwise ...
Comment #16
itamair CreditAttribution: itamair as a volunteer commentedIf you have great (and insurmountable problems) using Composer to download / updates your D8 requirements,
you may try this tool (free now): https://composy.io
to create and download your working environment locally, test that everything works properly and even take advantage of the contextually created composer.json ...
Comment #17
itamair CreditAttribution: itamair as a volunteer commentedComment #18
oheller CreditAttribution: oheller commentedI have the module installed using
composer require drupal/geofield
. I found that after using pantheon auto updates I had to runcomposer dump-autoload
. To be warned I also had a permission issue that I need to resolve with the vendor/composer/autoload_psr4.php.