* warning: Invalid argument supplied for foreach() in /home/unionsites/drupal-5.2/sites/all/modules/views/views_query.inc on line 81.
    * warning: Invalid argument supplied for foreach() in /home/unionsites/drupal-5.2/sites/all/modules/views/views_query.inc on line 16.
    * warning: Invalid argument supplied for foreach() in /home/unionsites/drupal-5.2/sites/all/modules/views/views_query.inc on line 195.
    * warning: Invalid argument supplied for foreach() in /home/unionsites/drupal-5.2/sites/all/modules/views/views_query.inc on line 220.
    * warning: Invalid argument supplied for foreach() in /home/unionsites/drupal-5.2/sites/all/modules/views/views.module on line 1277.
    * warning: Invalid argument supplied for foreach() in /home/unionsites/drupal-5.2/sites/all/modules/views_fusion/views_fusion.module on line 428.

I solved the problem by putting the following lines in the views_fusion_views_query_alter() function:

317       //set page type to table view, so that the fields get built
318       $fuse_view->page = 1;
319       $fuse_view->page_type = 'table';
320
321       // SD: Added following lines to suppress error
322       if (!$fuse_view->filter) {
323         $fuse_view->filter = array();
324       }
325       if (!$fuse_view->argument) {
326         $fuse_view->argument = array();
327       }
328       if (!$fuse_view->sort) {
329         $fuse_view->sort = array();
330       }
331       if (!$fuse_view->field) {
332         $fuse_view->field = array();
333       }
334       // END SD
335       // call this hook for the fused view and set the query object reference
336       $info = _views_build_query($fuse_view, $view->args, views_get_filter_values());

Not sure if something I did wrong is causing these errors or not. Looking for feedback before I roll a patch.

Comments

nevets’s picture

My feeling is it would be better to add a cast to the code with the for loop, something like this

foreach ( (array)$variable ... )

this way the code with the loop is defensive and does not rely on the callers actions.

fago’s picture

hm, strange that it seems that your are the only one facing this problem. Are you sure, that you are using compatible views + views fusion versions?

Steve Dondley’s picture

Status: Active » Closed (fixed)

It turns out one of the views that made up the views fusion had been deleted.