Problem

A site is getting the error below after updating to the latest dev (Dec 6, 2012) when adding a node.

Notice: Undefined index: P in geoPHP::load() (line 62 of /path/to/sites/all/modules/geophp/geoPHP/geoPHP.inc).
Geofield: Specified location data is invalid.

Please note that I have not switched widget types and that this error is preventing node creation.

Important

This error also can also be found in issue Cannot safely change widget type. The site is using the dev version that contains the patch from that issue.

Proposed resolution

I don't know all of the changes between the dev versions but I'm going to try to revert to the previous dev code.

Remaining tasks

Does anyone else have this issue?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

GreenSkunk’s picture

Reverting back to November 6 2012 dev and have no issues. I'm willing to test any patches on the latest dev.

mglaredo’s picture

Version: 7.x-2.x-dev » 7.x-1.0

I'm experimenting the same problem on using OPENOUTREACH (openoutreach-7.x-1.0-rc7-core.tar.gz) Distribution. The error arise when adding location content

Warning: Illegal string offset 'input_format' en geofield_geom_is_empty() (línea 217 de /openoutreach/modules/contrib/geofield/geofield.module).
Warning: Illegal string offset 'geom' en geofield_validate_geom() (línea 201 de /openoutreach/profiles/openoutreach/modules/contrib/geofield/geofield.module).
Warning: Illegal string offset 'input_format' en geofield_validate_geom() (línea 201 de /openoutreach/profiles/openoutreach/modules/contrib/geofield/geofield.module).
Notice: Undefined index: P en geoPHP::load() (línea 62 de /openoutreach/profiles/openoutreach/modules/contrib/geophp/geoPHP/geoPHP.inc).
Geolocation: Specified location data is invalid.

Any advice?
Thanks!

gease’s picture

FileSize
587 bytes

It's a problem with OpenLayers widget. Seems that the data format has changed - geofield expects to receive an array ($data, $format), while openlayers still give a string.
A quick fix is attached.

gease’s picture

Status: Active » Needs review
technocrat’s picture

Thanks, the patch worked for me on the latest OpenOutreach RC 7.

FranciscoLuz’s picture

Thanks gease,

The patch on #3 has fixed it for me too.

Brandonian’s picture

Status: Needs review » Fixed
mglaredo’s picture

Status: Fixed » Active

Warning: Illegal string offset 'input_format' en geofield_geom_is_empty() (línea 232 de /opt/lampp/htdocs/openoutreach/profiles/openoutreach/modules/contrib/geofield/geofield.module).

Persistest and geolocation data not saved and not displayed on map. I've applied both patchs separately but not work completely.

Someone on the same state? Thanks.

nedjo’s picture

Status: Active » Fixed

@lupin3_20hot: a fix has been applied so, to test, you need to use the dev version of geofield rather than applying patches. Restoring fixed status. Please reopen if it persists with the 2.x dev release.

mglaredo’s picture

Sorry nedjo, I'm going to install 7.x-2.x-dev and tell you. I'm just starting with drupal, I'll take care with the state time next.

Thanks.

nedjo’s picture

@lupin3_20hot: no prob, it's great that you're getting right in and contributing to issues and testing.

mglaredo’s picture

Version: 7.x-1.0 » 7.x-2.x-dev
Status: Fixed » Active

No way. I've replaced my geofield contrib directory inside openoutreach profile with 7.x-2.x-dev, but problem with geolocation field persists.

Warning: Illegal string offset 'input_format' en geofield_geom_is_empty() (línea 232 de /opt/lampp/htdocs/openoutreach/profiles/openoutreach/modules/contrib/geofield/geofield.module).

The node is created, but without geolocation value. I don't know what to do. I've clear all cache, restart http server but nothing...

Any suggestion? Thanks

mradcliffe’s picture

Status: Active » Needs review
FileSize
584 bytes

The empty calculations need to be adjusted too. $item['geom'] is always going to be empty if $item is a string.

Also, #1881056: Exception: geoPHP could not find an adapter of type in geoPHP::load() (line 54) seems to be a duplicate of this issue with some helpful explanation in the issue summary.

phayes’s picture

Status: Needs review » Reviewed & tested by the community

This looks good.

phayes’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
2.31 KB

Acutally, I thought of a slighter cleaner and more robust way to do this. Here we go -- this needs review / testing...

GreenSkunk’s picture

@phayes Thank You very much! Tested and it fixed several issues on a site as it is no longer have an issue with geofield not being saved after geocoding from AddressField.

Note: also downloaded the latest geoPHP library and overwrote the directory in the geoPHP module.

ipwa’s picture

Status: Needs review » Reviewed & tested by the community

Was having trouble with geofield input with openlayers and this totally solves it.

ipwa’s picture

Status: Reviewed & tested by the community » Needs work

Actually when I edit my geofield and try to limit it to only accept points in the map I get the same error when I try to save.

GaborTorok’s picture

julien.reulos’s picture

I confirm that the patch provided here is not necessary if you apply the last patch from #1871510: OpenLayers Widget: Exception: geoPHP could not find an adapter of type in geoPHP::load() (updating also the module to the last dev version).

Evokea’s picture

Version: 7.x-2.x-dev » 7.x-2.0
Component: Code » Documentation

Notice: Undefined index: P in geoPHP::load() (line 51 of /path/to/sites/all/modules/geophp/geoPHP/geoPHP.inc).
Geofield: Specified location data is invalid.

Uploaded all the recommended modules and libraries, but still getting the above error.

Can anybody list the modules and Libraries that will get this to work. or should be add all the above patches. Would love to get this going

mglaredo’s picture

Good morning Evokea,

I fixed the problem from my own, inside the code. If I well remember, It was not so difficult.

Right now I don't have access to the testing server where I fixed it, in some time I'll send you more exact info.

mglaredo’s picture

If you felt into same error and me, this was my solution:

- Geofield version: 7.x-2.0-alpha2+2-dev
- I made minimal changes, as you can see with the output from a diff:

$> diff geofield.module geofield.module.orig
231,232c231
< function geofield_geom_is_empty($item) {
< if ( is_string($item) ) { return empty($item);}
---
> function geofield_geom_is_empty($item) {
328c327
< return is_string($item) ? empty($item) : empty($item['geom']);
---
> return empty($item['geom']);

I hope it's useful.

suffering drupal’s picture

Hello,

I am having the same problem now, using/trying Open Outreach.
I say "now" because first I hadn't, although I don't know what has changed, after the ever unavoidable and confusing updates, new modules, crons that Drupal always puts you through.
Anyway, this is when I (NOW) get this error:
1 - Create new Article (where I added Map option), without a map!
2 - Save, and the page comes up well, BUT
3 - try to edit this page -> Undefined index: en geoPHP::load() etc.
However, this did not and still not happens with some older pages that also do NOT have a location, eg:
http://www.infosevilla.com/es/estaciones-de-autobuses - can access edit, no error
http://www.infosevilla.com/es/sin-animo-de-lucro - cannot be edited anymore.
the other site:
http://visitaramsterdam.info/tur-por-los-canales - can access edit, no error
http://visitaramsterdam.info/tryouts - just created right now.... AND... ERROR!!! I included all the installed stuff and versions on this page, have a look if you want.

Oh, what might influence is activation of Locale and Language/translation stuff maybe. I'll have a look at that when I feel mentally strong enough to go through it again, might also make a tryout page, with versions, on infosevilla to compare the two.

suffering drupal’s picture

I have tried de-activating "Locale" (+content translation, etc), but I only achieved that all contents disappeared, so that's a no-go :(
While trying I seem to have triggered a new additional problem however :((

suffering drupal’s picture

I did find empty data (all 0 and NULL) in the field_data_field_geolocation table for the two articles that have this problem, while the Article without location that CAN be edited (is older) does not have an entrance in this table. I tried deleting one of the entrances of the articles with the problem, but that didn't solve.
Anyway, it seems the entrances should have not been created in the first place, when no location is indicated. But this can only suddenly have started to occur after modifying something somewhere in the Geo part (which I don't remember) or after installing some module that affects this (like Locale as I thought before).
Hope this helps as a clue for one who understands...

gagarine’s picture

Version: 7.x-2.0 » 7.x-2.3
Issue summary: View changes
candelas’s picture

@suffering drupal, I could make it by deleting in the field table and the REVISION table. They were null because I imported them. Not patch was needed with the last version, 7.x-2.3.

robcarr’s picture

I got around this problem by updating the GeoPHP library (https://github.com/phayes/geoPHP) which is part of the Drupal GeoPHP module. Unfortunately, the D7 GeoPHP module doesn't use Libraries, and the module itself hasn't been touched for a few years