I get the error "warning: Invalid argument supplied for foreach() in /.../modules/views/plugins/views_plugin_display.inc on line 547." when attempting to views a view using the GMap style plugin. No map displays. Also, on the view's edit page, I get the following above the display preview:

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

I'm using GMap 6.x-1.1-rc1 and Views 6.x-2.6.

Comments

seanr’s picture

BTW, here are the node and view definitions if you want to try to recreate it:

$content['type']  = array (
  'name' => 'Supporter',
  'type' => 'supporter',
  'description' => '',
  'title_label' => 'Name',
  'body_label' => '',
  'min_word_count' => '0',
  'help' => '',
  'node_options' => 
  array (
    'status' => true,
    'promote' => false,
    'sticky' => false,
    'revision' => false,
  ),
  'forward_display' => 0,
  'nodewords' => 0,
  'upload' => '1',
  'excerpt' => '0',
  'old_type' => 'supporter',
  'orig_type' => '',
  'module' => 'node',
  'custom' => '1',
  'modified' => '1',
  'locked' => '0',
  'og_content_type_usage' => 'omitted',
  'comment' => '0',
  'comment_default_mode' => '4',
  'comment_default_order' => '1',
  'comment_default_per_page' => '50',
  'comment_controls' => '3',
  'comment_anonymous' => 0,
  'comment_subject_field' => '1',
  'comment_preview' => '1',
  'comment_form_location' => '0',
  'image_attach' => '0',
  'image_attach_size_teaser' => 'thumbnail',
  'image_attach_weight_teaser' => '0',
  'image_attach_size_body' => 'preview',
  'image_attach_weight_body' => '0',
);
$content['fields']  = array (
  0 => 
  array (
    'label' => 'Email',
    'field_name' => 'field_email',
    'type' => 'email',
    'widget_type' => 'email_textfield',
    'change' => 'Change basic information',
    'weight' => '-4',
    'size' => '60',
    'description' => '',
    'default_value' => 
    array (
      0 => 
      array (
        'email' => '',
      ),
    ),
    'default_value_php' => '',
    'default_value_widget' => NULL,
    'required' => 1,
    'multiple' => '0',
    'op' => 'Save field settings',
    'module' => 'email',
    'widget_module' => 'email',
    'columns' => 
    array (
      'email' => 
      array (
        'type' => 'varchar',
        'length' => 255,
        'not null' => false,
        'sortable' => true,
      ),
    ),
    'display_settings' => 
    array (
      'weight' => '-4',
      'parent' => '',
      'label' => 
      array (
        'format' => 'hidden',
      ),
      'teaser' => 
      array (
        'format' => 'hidden',
        'exclude' => 0,
      ),
      'full' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      4 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      'token' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
    ),
  ),
  1 => 
  array (
    'label' => 'Location',
    'field_name' => 'field_location',
    'type' => 'location',
    'widget_type' => 'location',
    'change' => 'Change basic information',
    'weight' => '-3',
    'description' => '',
    'default_value' => 
    array (
      0 => 
      array (
        'name' => '',
        'street' => '',
        'additional' => '',
        'country' => 'us',
        'locpick' => 
        array (
          'user_latitude' => '',
          'user_longitude' => '',
        ),
        'cck_preview_in_progress' => true,
        'location_settings' => 
        array (
          'form' => 
          array (
            'fields' => 
            array (
              'lid' => 
              array (
                'default' => false,
              ),
              'name' => 
              array (
                'default' => '',
                'collect' => 1,
                'weight' => 2,
              ),
              'street' => 
              array (
                'default' => '',
                'collect' => 1,
                'weight' => 4,
              ),
              'additional' => 
              array (
                'default' => '',
                'collect' => 1,
                'weight' => 6,
              ),
              'city' => 
              array (
                'default' => '',
                'collect' => 0,
                'weight' => 8,
              ),
              'province' => 
              array (
                'default' => '',
                'collect' => 0,
                'weight' => 10,
              ),
              'postal_code' => 
              array (
                'default' => '',
                'collect' => 0,
                'weight' => 12,
              ),
              'country' => 
              array (
                'default' => 'us',
                'collect' => 1,
                'weight' => 14,
              ),
              'locpick' => 
              array (
                'default' => false,
                'collect' => 1,
                'weight' => 20,
                'nodiff' => true,
              ),
              'latitude' => 
              array (
                'default' => 0,
              ),
              'longitude' => 
              array (
                'default' => 0,
              ),
              'source' => 
              array (
                'default' => 0,
              ),
              'is_primary' => 
              array (
                'default' => 0,
              ),
              'delete_location' => 
              array (
                'default' => false,
                'nodiff' => true,
              ),
            ),
          ),
        ),
      ),
    ),
    'default_value_php' => '',
    'default_value_widget' => 
    array (
      'field_location' => 
      array (
        0 => 
        array (
          'lid' => false,
          'name' => '',
          'street' => '',
          'additional' => '',
          'city' => '',
          'province' => '',
          'postal_code' => '',
          'country' => 'us',
          'locpick' => 
          array (
            'user_latitude' => '',
            'user_longitude' => '',
          ),
          'latitude' => 0,
          'longitude' => 0,
          'source' => 0,
          'is_primary' => 0,
          'delete_location' => false,
          'cck_preview_in_progress' => true,
          'location_settings' => 
          array (
            'form' => 
            array (
              'fields' => 
              array (
                'name' => 
                array (
                  'default' => '',
                  'collect' => '0',
                  'weight' => '2',
                ),
                'street' => 
                array (
                  'default' => '',
                  'collect' => '0',
                  'weight' => '4',
                ),
                'additional' => 
                array (
                  'default' => '',
                  'collect' => '0',
                  'weight' => '6',
                ),
                'city' => 
                array (
                  'default' => '',
                  'collect' => '0',
                  'weight' => '8',
                ),
                'province' => 
                array (
                  'default' => '',
                  'collect' => '0',
                  'weight' => '10',
                ),
                'postal_code' => 
                array (
                  'default' => '',
                  'collect' => 1,
                  'weight' => '12',
                ),
                'country' => 
                array (
                  'default' => 'us',
                  'collect' => '4',
                  'weight' => '14',
                ),
                'locpick' => 
                array (
                  'default' => 
                  array (
                    'user_latitude' => '',
                    'user_longitude' => '',
                  ),
                  'collect' => '0',
                  'weight' => '20',
                  'nodiff' => true,
                ),
                'cck_preview_in_progress' => 
                array (
                  'default' => true,
                ),
                'location_settings' => 
                array (
                  'default' => 
                  array (
                    'form' => 
                    array (
                      'fields' => 
                      array (
                        'lid' => 
                        array (
                          'default' => false,
                        ),
                        'name' => 
                        array (
                          'default' => '',
                          'collect' => 1,
                          'weight' => 2,
                        ),
                        'street' => 
                        array (
                          'default' => '',
                          'collect' => 1,
                          'weight' => 4,
                        ),
                        'additional' => 
                        array (
                          'default' => '',
                          'collect' => 1,
                          'weight' => 6,
                        ),
                        'city' => 
                        array (
                          'default' => '',
                          'collect' => 0,
                          'weight' => 8,
                        ),
                        'province' => 
                        array (
                          'default' => '',
                          'collect' => 0,
                          'weight' => 10,
                        ),
                        'postal_code' => 
                        array (
                          'default' => '',
                          'collect' => 0,
                          'weight' => 12,
                        ),
                        'country' => 
                        array (
                          'default' => 'us',
                          'collect' => 1,
                          'weight' => 14,
                        ),
                        'locpick' => 
                        array (
                          'default' => false,
                          'collect' => 1,
                          'weight' => 20,
                          'nodiff' => true,
                        ),
                        'latitude' => 
                        array (
                          'default' => 0,
                        ),
                        'longitude' => 
                        array (
                          'default' => 0,
                        ),
                        'source' => 
                        array (
                          'default' => 0,
                        ),
                        'is_primary' => 
                        array (
                          'default' => 0,
                        ),
                        'delete_location' => 
                        array (
                          'default' => false,
                          'nodiff' => true,
                        ),
                      ),
                    ),
                  ),
                ),
                'lid' => 
                array (
                  'default' => false,
                ),
                'latitude' => 
                array (
                  'default' => 0,
                ),
                'longitude' => 
                array (
                  'default' => 0,
                ),
                'source' => 
                array (
                  'default' => 0,
                ),
                'is_primary' => 
                array (
                  'default' => 0,
                ),
                'delete_location' => 
                array (
                  'default' => false,
                  'nodiff' => true,
                ),
              ),
            ),
            'display' => 
            array (
              'hide' => 
              array (
                'name' => 0,
                'street' => 0,
                'additional' => 0,
                'city' => 0,
                'province' => 0,
                'postal_code' => 0,
                'country' => 0,
                'locpick' => 0,
                'province_name' => 0,
                'country_name' => 0,
                'map_link' => 0,
                'coords' => 0,
              ),
            ),
          ),
        ),
      ),
    ),
    'required' => 0,
    'multiple' => '0',
    'location_settings' => 
    array (
      'form' => 
      array (
        'fields' => 
        array (
          'name' => 
          array (
            'collect' => '0',
            'default' => '',
            'weight' => '2',
          ),
          'street' => 
          array (
            'collect' => '0',
            'default' => '',
            'weight' => '4',
          ),
          'additional' => 
          array (
            'collect' => '0',
            'default' => '',
            'weight' => '6',
          ),
          'city' => 
          array (
            'collect' => '0',
            'default' => '',
            'weight' => '8',
          ),
          'province' => 
          array (
            'collect' => '0',
            'default' => '',
            'weight' => '10',
          ),
          'postal_code' => 
          array (
            'collect' => '2',
            'default' => '',
            'weight' => '12',
          ),
          'country' => 
          array (
            'collect' => '4',
            'default' => 'us',
            'weight' => '14',
          ),
          'locpick' => 
          array (
            'collect' => '0',
            'weight' => '20',
          ),
        ),
      ),
      'display' => 
      array (
        'hide' => 
        array (
          'name' => 0,
          'street' => 0,
          'additional' => 0,
          'city' => 0,
          'province' => 0,
          'postal_code' => 0,
          'country' => 0,
          'locpick' => 0,
          'province_name' => 0,
          'country_name' => 0,
          'map_link' => 0,
          'coords' => 0,
        ),
      ),
    ),
    'op' => 'Save field settings',
    'module' => 'location_cck',
    'widget_module' => 'location_cck',
    'columns' => 
    array (
      'lid' => 
      array (
        'type' => 'int',
        'unsigned' => true,
        'not null' => false,
      ),
    ),
    'display_settings' => 
    array (
      'weight' => '-3',
      'parent' => '',
      'label' => 
      array (
        'format' => 'hidden',
      ),
      'teaser' => 
      array (
        'format' => 'hidden',
        'exclude' => 0,
      ),
      'full' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      4 => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
      'token' => 
      array (
        'format' => 'default',
        'exclude' => 0,
      ),
    ),
  ),
);
$content['extra']  = array (
  'title' => '-5',
  'revision_information' => '-1',
  'comment_settings' => '2',
  'menu' => '-2',
  'path' => '1',
  'attachments' => '0',
);
$view = new view;
$view->name = 'supporters_map';
$view->description = 'Google map displaying locations of supporters';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', NULL);
$handler->override_option('filters', array(
  'status_extra' => array(
    'operator' => '=',
    'value' => '',
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'status_extra',
    'table' => 'node',
    'field' => 'status_extra',
    'relationship' => 'none',
  ),
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'supporter' => 'supporter',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('cache', array(
  'type' => 'none',
));
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'gmap');
$handler->override_option('style_options', array(
  'macro' => '[gmap]',
  'datasource' => 'location',
  'latfield' => '',
  'lonfield' => '',
  'markers' => 'static',
  'markerfield' => '',
  'markertype' => 'blue',
));
$handler->override_option('row_plugin', 'node');
$handler->override_option('row_options', array(
  'relationship' => 'none',
  'build_mode' => 'teaser',
  'links' => 0,
  'comments' => 0,
));
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'supporters/map');
$handler->override_option('menu', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
  'name' => 'navigation',
));
$handler->override_option('tab_options', array(
  'type' => 'none',
  'title' => '',
  'description' => '',
  'weight' => 0,
));

seanr’s picture

Priority: Normal » Critical

I also tried using the regular node location instead of the CCK field, but that had no effect. Looking at the code in question, it looks like this module isn't passing the right data to the views module so it's completely hosed. Some help with this would be greatly appreciated - I've got a client who needs to get this working ASAP.

seanr’s picture

GMap 6.x-1.x-dev doesn't work either.

rooby’s picture

Title: warning: Invalid argument supplied for foreach() in /.../modules/views/plugins/views_plugin_display.inc on line 547. » Row style: node - Invalid argument supplied for foreach() in /.../modules/views/plugins/views_plugin_display.inc on line 547

The problem is due to Row style being node, not fields.

I'm too tired to look further into it now but soon.

[EDIT] removed reference to a duplicate issue as it seems it isn't a duplicate

rooby’s picture

Title: Row style: node - Invalid argument supplied for foreach() in /.../modules/views/plugins/views_plugin_display.inc on line 547 » Invalid argument supplied for foreach() in /.../modules/views/plugins/views_plugin_display.inc on line 568
Project: GMap Module » Views (for Drupal 7)
Version: 6.x-1.1-rc1 » 6.x-2.8

Renaming as the line number is different in 6.x-2.8

I have looked into this further now that I am more awake and the problem persists even if not using the gmap view style.
This seems to be an issue with views as opposed to gmap.

Also, please see #697794: Invalid argument in /views_plugin_display.inc on line 667 on default views only as this might be a duplicate of that issue just for a different views version.

merlinofchaos’s picture

Status: Active » Postponed (maintainer needs more info)

If this persists without using the gmap style, please provide reproduction instructions.

esmerel’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

No updates with more info in more than 30 days.