I've just updated from 6.x-1.0 to the latest dev and I'm getting the following error when editing my gmap views.

warning: Invalid argument supplied for foreach() in /public_html/sites/all/modules/gmap/gmap_plugin_style_gmap.inc on line 172.

I had been using the patch in #338587: Move views integration code to gmap_location module? to use individual longitude and latitude fields and that worked perfectly, but now the fields are blank (see attached image). The marker field is also blank.

I haven't made any changes to the latest dev code. Do I need to reapply the patch or is this now integrated?

CommentFileSizeAuthor
gmap_error.jpg44.38 KBsjf
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sjf’s picture

Still getting this with the latest dev. I've removed all third-party patches to gmap and location code, regenerated my marker cache, cleared both Drupal and Views cache, even uninstalled and reinstalled gmap. I think this error first appeared when I accidentally tried to set an invalid views field as the marker. Below is the code at lines 169-175.

    $options = array();
    // @@@ Fix this when I'm not having a monday morning.
    // There's likely a more "correct" way.
    foreach ($this->display->display_options['fields'] as $id => $handler) {
      $data = views_fetch_data($handler['table']);
      $options[$id] = $handler['label'];
    }
sjf’s picture

Okay, I can reproduce this on a clean Drupal 6.10 install with latest devs of Location, GMap and Views. No other modules installed.

1. Create a new view and add a page display
2. Add Latitude and Longitude fields, setting them to decimal degrees
3. Change the page display style to gmap, then try to edit the style options. The error message appears and if you change the "Data Source" select list to "choose latitude and longitude fields", there are none to choose from.

Hope that helps. Anyone else having this problem?

tom_o_t’s picture

I can reproduce this problem - Drupal 6.10, clean install, Garland theme, using just latest gmap 6.x-1.x-dev, location 6.x-3.x-dev, and views 6.x-2.3

I added a new view, selected "location" as my view type. On the next screen I changed 'style' to Gmap, and as soon as I updated that I got the error people mentioned above -

warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\map\sites\default\modules\contrib\gmap\gmap_plugin_style_gmap.inc on line 172.

As soon as I add a field to the view (e.g. node title) this error goes away and does not come back.

sjf’s picture

Interesting... I have several other fields (Location:City, Node title, node post date etc.) in the view but the error message remains.

PS tried with both public and private file system.

andrewsuth’s picture

I did a clean install with the new release of GMaps Module from today (6.x-1.1-rc1) along with the latest Location Module (6.x-3.1-rc1) and the error message is still persisting.

I have noticed that both the Longitude and Latitude drop-downs fields are empty while the other drop-downs seems to be correct.

When I then make a page view with a path, I get the following error when trying to access the page:
Fatal error: Cannot access empty property in \sites\all\modules\gmap\gmap_plugin_style_gmap.inc on line 97

Does this help at all?

steveoliver’s picture

I'm having the same issue. I've tried a few things which have not worked:

  1. Set the latitude and longitude 'default_value's on lines 182 and 191 to "$this->view->display_handler->get_handler('field', $this->options['latfield'])->field_alias" and "$this->view->display_handler->get_handler('field', $this->options['longfield'])->field_alias" (from lines 68 and 69).

    As the $options array (lines 169-175) still supplied no proper options...
  2. Set ("hard-coded") '#options' => array('latitude' => t('Latitude')), and '#options' => array('longitude' => t('Longitude'))

On step 2, I of course got those options in my Latitude Field and Longitude Field drop-downs, but my Gmap still won't show...

I don't understand how actual (Lat/Long,etc.) fields show up as drop down options for Latitude Field and Longitude Field in View Defaults Style Settings, but not in Page Style Settings.

:/

-Steve

jeff h’s picture

Can I clarify a little what Steve has discovered, and mentioned in the previous comment (we've been talking on IRC)...

If you get the error, you are probably editing the gmap settings in the "page" display (or some display other than the defaults one). Even if the style: GMap is not overridden, you should edit its settings when on the Defaults display, and you won't get the error.

At least that is how it is for me.

Obviously the error still exists -- if you look at the foreach loop:

foreach ($this->display->display_options['fields'] as $id => $handler) {

...$this->display->display_options['fields'] doesn't exist when you're on a display other than Defaults.

Jeff

bdragon’s picture

Assigned: Unassigned » bdragon

Finally, a way to reproduce. Thanks!

bdragon’s picture

OK, hopefully fixed. Could I get verification that this is working?

http://drupal.org/cvs?commit=182032

bdragon’s picture

Status: Active » Postponed (maintainer needs more info)
sjf’s picture

This does seem to have solved it for me. Thanks.

andrewsuth’s picture

Bravo. Fixed the error for me

anthonybruno’s picture

Fix worked for me as well.

rares’s picture

fixed for me too. I am having trouble with different markers for different roles though, which is probably unrelated. will try to find an issue about that or create one.
EDIT: distinct markers for user roles DO work

Sutharsan’s picture

Status: Postponed (maintainer needs more info) » Fixed

6.x-1.x-dev works for me too. I guess it is time for 'fixed'

Status: Fixed » Closed (fixed)

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

lam3001’s picture

We are having the same problem as poster #5:

Fatal error: Cannot access empty property in \sites\all\modules\gmap\gmap_plugin_style_gmap.inc on line 97

Drupal 6.11
GMap Module 6.x-1.1-rc1
Location 6.x-3.1-rc1
Views 6.x-2.5

So is this broken again? Or is there some other cause that we might have?

lam3001’s picture

Version: 6.x-1.x-dev » 6.x-1.1-rc1
Status: Closed (fixed) » Active
lam3001’s picture

Title: warning: Invalid argument supplied for foreach()...gmap_plugin_style_gmap.inc on line 172. » Fatal error: Cannot access empty property in \sites\all\modules\gmap\gmap_plugin_style_gmap.inc on line 97
beautifulmind’s picture

Title: Fatal error: Cannot access empty property in \sites\all\modules\gmap\gmap_plugin_style_gmap.inc on line 97 » warning: Invalid argument supplied for foreach()...gmap_plugin_style_gmap.inc on line 172.

I can't fix this any how.
Subscribing.

nicholasThompson’s picture

Status: Active » Fixed

I've updated from RC1 (6.x-1.1-rc1) to HEAD (6.x-1.x-dev) and this appears to have gone away - my Views embedded GMaps are working as expected now. Thanks...

dadderley’s picture

I came across this error. The gmap view worked with views-6.x-2.3 but shows this error when editing the view.
I did not notice this error (my bad)

I downloaded and installed gmap HEAD (6.x-1.x-dev) and this killed this error message:
warning: Invalid argument supplied for foreach()...gmap_plugin_style_gmap.inc on line 172
It all works.

When I upgraded views to views-6.x-2.5, I get the WSOD and this error:
Fatal error: Cannot access empty property in /home/thindig5/public_html/kzoocpcl/modules/views/modules/node.views.inc on line 670

Probably unrelated, but I only get this on the gmap view and no others.

chaosprinz’s picture

I had the same issue with the latest dev of gmap and views 2.5. After reading this isue, i downgraded to views2.3 and now it works fine. Thx a lot

dadderley’s picture

I really hope that this gets fixed as I cannot update the views module on 3 sites because of this.

sjf’s picture

I haven't seen this problem since the last time I posted. I'm using Views 2.5 but I'm using the GMap -dev from March 14. I never got around to updating to the current April 18 -dev.

Sounds like there was a change between the March 14 and April 18 GMap -dev that broke this again.

beautifulmind’s picture

I am using the same GMam-dev version and having problem with views 2.5 and 2.4, but still having problems.

Status: Fixed » Closed (fixed)

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

Webster619’s picture

Sorry to open this up again, but I am getting the same error:

warning: Invalid argument supplied for foreach() in /modules/gmap/gmap_plugin_style_gmap.inc on line 172.

Am I supposed to downgrade to views 2.3?

I'm using views 2.5 and gmap rc1.

Webster619’s picture

Status: Closed (fixed) » Active

Sorry to open this up again, but I am getting the same error:

warning: Invalid argument supplied for foreach() in /modules/gmap/gmap_plugin_style_gmap.inc on line 172.

Am I supposed to downgrade to views 2.3?

I'm using views 2.5 and gmap rc1.

chaosprinz’s picture

It seems that views2.6 and the latest dev of gmap solve this problem. So upgrade your views to 2.6 and take the latest dev of gmap instead of rc1. For me it works.

Rustan’s picture

Confirming #30. I had the error, upgraded gmap from rc1 to dev from jun 9, error disappeared. Already had views2.6.

ChrisRut’s picture

:subscribe:

chadd’s picture

subscribe

tengoku’s picture

had this error and fixed with last update.... funny working module version is 1.0 i had a 1.1rc somewere

garbanzito’s picture

confirming #34 above with slightly more detail -- i am working on an install profile and was getting the same error as the OP:

warning: Invalid argument supplied for foreach() in /public_html/sites/all/modules/gmap/gmap_plugin_style_gmap.inc on line 172.

when editing a view using the Gmap style

when i set up my drush make file a few days ago, it was specifying

projects[gmap] = 1.1-rc1
projects[views] = 2.8

after getting the error, switched to

projects[gmap] = 1.x-dev
projects[views] = 2.8

and reran and the error was gone

Danny Englander’s picture

Version: 6.x-1.1-rc1 » 6.x-1.x-dev

I am having the same exact issue with 6.x-1.x-dev from Jan 24 2010.

zmove’s picture

Same issue : April 2010...

Macronomicus’s picture

Version: 6.x-1.x-dev » 6.x-1.1-rc1
Status: Active » Fixed

The prob is in 6.x-1.1-rc1 ... March 4, 2009
It is still fixed in the 6.x-1.x-dev 2010-Apr-09

The release numbers are a bit misleading, just did an update and installed 1.1 on accident thinking it was newer... why didnt I look at the date? lol

I am using views 3.x if that matters

Dont use 6.x-1.1-rc1

clemens.tolboom’s picture

@Marcoon : tnx for noting the release dates. I was puzzling why 1.1-rc1 was not working as expected.

It would be nice to get this release unpublished ... drush picked it up for me :(

Trouble is the date span between the different versions ... 6.x-1.0 is _old_ but adviced.

Macronomicus’s picture

I will create a separate issue to dump that release.

Status: Fixed » Closed (fixed)

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

AlanAtLarge’s picture

Me too: subscribe

jorgensa’s picture