It looks like all previous default values are kept in the field settings.

If we change from lat/lon (or bounds) to wkt (or json) then $items[$delta]['geom'] will not be empty.
In fact, it will contain an array of coordinates (lat, lon and/or top, right, bottom, left).

As soon as we try and edit the field after the change we have a critical exception:

Warning: fwrite() expects parameter 2 to be string, array given in geoPHP::detectFormat() (line 213 of [...]/sites/all/modules/geophp/geoPHP/geoPHP.inc).

Notice: Undefined index: in geoPHP::load() (line 62 of [...]/sites/all/modules/geophp/geoPHP/geoPHP.inc).

Exception: geoPHP could not find an adapter of type in geoPHP::load() (line 65 of [...]/sites/all/modules/geophp/geoPHP/geoPHP.inc).

CommentFileSizeAuthor
#6 geofield-instance_recursion-1840920-6.patch687 bytesplach
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tito.brasolin’s picture

Maybe hook_field_update_instance can be used to empty the default value after the widget type has changed?

phayes’s picture

Priority: Normal » Major

upgrading this to critical. This is pretty bad.

Brandonian’s picture

Status: Active » Fixed

@tito.brasolin, good call on hook_field_update_instance. I've committed a fix to deal with this issue. Any time the widget is changed, we clear out the default values.

http://drupalcode.org/project/geofield.git/commit/6b59c3e

Mac_Weber’s picture

Status: Fixed » Needs work

I'm getting the same error of line 65. Not sure if I should open a new issue, because I'm actually getting it running drush sorl-index:

$ drush solr-index
WD php: Exception: geoPHP could not find an adapter of type  in geoPHP::load() (line 65 of                                                        [error]
/var/www/sites/all/modules/contrib/geophp/geoPHP/geoPHP.inc).
Exception: geoPHP could not find an adapter of type  em geoPHP::load() (linha 65 de /var/www/sites/all/modules/contrib/geophp/geoPHP/geoPHP.inc).
Drush command terminated abnormally due to an unrecoverable error.                                                                                [error]
Mac_Weber’s picture

Status: Needs work » Closed (fixed)

Well, I changed the widget to a different one and back to the old one. Everything is working fine now with drush.
I think it was because I had the 7.x-1.1 version installed before

plach’s picture

Status: Closed (fixed) » Needs review
FileSize
687 bytes

Small followup: I got infinite recursion while enabling Commerce Coupon Percentage, which triggers an update of field instances and does not populate the $instance['widget']['type']['key']. The attached patch fixes it and avoids any possibilty of recursions by not invoking the update hook and doing a straight field instance save.

Brandonian’s picture

Status: Needs review » Fixed

Thanks for the followup patch, @plach! Committed to 7.x-2.x

http://drupalcode.org/project/geofield.git/commit/17052f3

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Ohoshi’s picture

Issue summary: View changes

I installed the latest version(Geofield 7.x-2.1) and encounter this problem.
Really need help, thanks!!