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.
Using latest dev (today, January 14th), when I go to the edit page of a geofield field with Openlayer Widget, I get this:
Fatal error: Class 'GeometryCollection' not found in /sites/all/modules/openlayers/modules/openlayers_geofield/src/Plugin/Component/GeofieldWidget/GeofieldWidget.php on line 133
If I use the dev version before the latest, everything works.
PS. Seems to me that the issue is NOT that the composer dependency is wrong. It's that geophp ISN'T loaded at the time it's needed, although it's correctly installed.
Comment | File | Size | Author |
---|---|---|---|
#16 | openlayers-load-geophp-in-start-of-dot-module.patch | 516 bytes | rsvelko |
| |||
#16 | openlayers-load-geophp-in-GeofieldWidget.patch | 1.15 KB | rsvelko |
#9 | drush.jpg | 122.58 KB | altbzh1 |
#9 | Sans titre.jpg | 142.82 KB | altbzh1 |
Comments
Comment #2
rsvelko CreditAttribution: rsvelko commentedsimple solution is to use the last OL module release - 7.x-3.1
this works I tested now.
Me too tried with the git clone of the latest OL dev but it gives this error you mention.
So I did this to my git repo - git checkout 7.x-3.1 and it works - effectively it is the same as downloading the rlease from the tar.gz at d.o.
Making sense ?
Comment #3
m.stentaI haven't looked at the recent development - but maybe some of the files moved around. Did you try rebuilding the registry?
drush registry-rebuild
Comment #4
PolHi,
Thanks for helping in the issue queue :-)
I'm quite busy rewriting Geocoder (https://github.com/drupol/geocoder) 2.x and things might be broken in Openlayers. Sorry for that.
I will fix everything for the 3.2 release at the end of the month, if everything goes well.
Thanks!
Comment #5
PolHere's the procedure to get this fixed. As you may have seen, there's a composer.json file in the openlayers_geofield submodule.
this files contains:
Basically, this file says that you need the geophp library in order to have a module working properly.
You could either download it manually and do your stuff alone (which is not recommended at all) OR you can download the newly added dependencies Composer Manager and do things properly.
There's a couple of extra steps, here's the full procedure to get everything working:
Here's the log on my machine...
EDIT: if you have troubles, check this issue : #2567885: Error creating directory: public://composer in composer_manager_file_dir(), there's a fix at the end.
Good luck.
Comment #6
PolComment #7
rollingnet CreditAttribution: rollingnet commentedAs you can see, I installed geophp correctly following your indication,
but the error
is still present
Comment #8
aDarkling CreditAttribution: aDarkling as a volunteer commentedI also reinstalled phayes/geophp per the instructions and got good marks from both admin/reports/status and admin/config/system/composer-manager
The error's still there.
Comment #9
altbzh1 CreditAttribution: altbzh1 commentedHi
It's absolute hell ... ti install this.
I have installed crush via composer, so I have already composer components :
That's the settings I write in the Composer Manager settings.
Before I had many packages written in packages tap of component manager with drush "no longer required"
I use enable openlayers_examples accept to update dependencies : geoPHP library is ok but I have no more Drush ...
So how do we have to do to keep it ?
Thank you
Comment #10
altbzh1 CreditAttribution: altbzh1 commentedHi
It's absolute hell ... ti install this.
I have installed crush via composer, so I have already composer components :
That's the settings I write in the Composer Manager settings.
Before I had many packages written in packages tap of component manager with drush "no longer required"
I use enable openlayers_examples accept to update dependencies : geoPHP library is ok but I have no more Drush ...
So how do we have to do to keep it ?
Thank you
Comment #11
PolHi,
I know it's not easy especially when module are in dev.
I'm working on a solution, it might take a bit of time these days, I'm busy on something else right now.
I'll update this thread when I'll do something.
Comment #12
aDarkling CreditAttribution: aDarkling as a volunteer commentedThe geophp library isn't loaded.
Add
geophp_load();
before that first call to the GeometryCollection class and everything should be all right.Geofields also loads this library, so that's why the problem seems to go away sometimes.
Comment #13
rollingnet CreditAttribution: rollingnet commentedI can confirm that inserting
geophp_load();
at line #133 of sites/all/modules/openlayers/modules/openlayers/src/Plugin/Component/GeofieldWidget/GeofieldWidget.php
solves this issue
by now, everything seems to work well with this patch
Comment #14
rsvelko CreditAttribution: rsvelko commentedwith the latest git version of OL3, the path is ./sites/all/modules/openlayers/modules/openlayers_geofield/src/Plugin/Component/GeofieldWidget/GeofieldWidget.php
other than that editing line 133 there and putting geophp_load(); on it worked fine here too.
I am using these modules - most of them via git latest dev
admin_menu
composer_manager
computed_field
ctools
elements
entity
feeds
gdal
geocoder
geofield
geofield_postgis
geophp
git_deploy
job_scheduler
jquery_update
libraries
module_filter
openlayers
postgis
README.txt
registry_autoload
service_container
sync_postgis
views
views_geojson
Comment #15
Syntapse CreditAttribution: Syntapse as a volunteer commentedi eliminated this error by running
composer install
in thesites/all/modules/openlayers/modules/openlayers_geofield
folder.Possible that composer's dependency hierarchy is not correctly defined?
Comment #16
rsvelko CreditAttribution: rsvelko commentedI dont know where is the best place for:
geophp_load();
but putting it anywhere I tried seems to work the same.
Here are two patches and lets review and commit sth similar.
Comment #17
rsvelko CreditAttribution: rsvelko as a volunteer commented