warning: Invalid argument supplied for foreach()...gmap_plugin_style_gmap.inc on line 172.

sjf - February 8, 2009 - 19:28
Project:GMap Module
Version:6.x-1.1-rc1
Component:Code
Category:bug report
Priority:normal
Assigned:bdragon
Status:active
Description

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?

AttachmentSize
gmap_error.jpg44.38 KB

#1

sjf - February 25, 2009 - 13:31

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'];
    }

#2

sjf - February 27, 2009 - 16:25

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?

#3

tom_o_t - February 28, 2009 - 02:16

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.

#4

sjf - February 28, 2009 - 07:37

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.

#5

andrewsuth - March 4, 2009 - 02:11

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?

#6

steveoliver - March 10, 2009 - 23:55

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

#7

jeff h - March 11, 2009 - 01:34

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

#8

bdragon - March 11, 2009 - 17:09
Assigned to:Anonymous» bdragon

Finally, a way to reproduce. Thanks!

#9

bdragon - March 11, 2009 - 17:42

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

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

#10

bdragon - March 13, 2009 - 15:05
Status:active» postponed (maintainer needs more info)

#11

sjf - March 14, 2009 - 09:18

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

#12

andrewsuth - March 14, 2009 - 11:13

Bravo. Fixed the error for me

#13

anthonybruno - March 20, 2009 - 22:04

Fix worked for me as well.

#14

rares - March 25, 2009 - 20:15

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

#15

Sutharsan - March 26, 2009 - 17:31
Status:postponed (maintainer needs more info)» fixed

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

#16

System Message - April 9, 2009 - 17:40
Status:fixed» closed

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

#17

lam3001 - May 5, 2009 - 16:57

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?

#18

lam3001 - May 5, 2009 - 16:58
Version:6.x-1.x-dev» 6.x-1.1-rc1
Status:closed» active

#19

lam3001 - May 5, 2009 - 17:00
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

#20

beautifulmind - May 5, 2009 - 17:00
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.

#21

nicholasThompson - May 12, 2009 - 21:46
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...

#22

dougzilla - May 15, 2009 - 22:26

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.

#23

chaosprinz - May 26, 2009 - 08:06

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

#24

dougzilla - May 26, 2009 - 18:22

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

#25

sjf - May 27, 2009 - 09:56

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.

#26

beautifulmind - May 27, 2009 - 13:17

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

#27

System Message - June 10, 2009 - 13:20
Status:fixed» closed

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

#28

Webster619 - June 16, 2009 - 03:15

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.

#29

Webster619 - June 16, 2009 - 03:15
Status:closed» 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.

#30

chaosprinz - June 16, 2009 - 05:43

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.

#31

Rustan - July 12, 2009 - 18:58

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

#32

ChrisRut - November 3, 2009 - 21:18

:subscribe:

#33

chadd - December 6, 2009 - 05:12

subscribe

 
 

Drupal is a registered trademark of Dries Buytaert.