Drupal Views allows creation of a View without explicitly defined fields. If you are creating a List view, you don't need to define fields. However, i18ntaxonomy module assumes that any view always has an array of fields, and on line 578, in function i18ntaxonomy_views_pre_view(&$view, &$items) uses the a 'foreach' without first checking if the argument of foreach is an array. This leads to a PHP warning, as soon as you enable the module, if you have a view without explicitly defined fields.

You will get a nasty warning like the following:

warning: Invalid argument supplied for foreach() in /...deleted.../sites/all/modules/i18n/i18ntaxonomy/i18ntaxonomy.module on line 578.
 

FIX: please add the check before the foreach so the code reads something like:

  if ( ! is_array($view->field)) { return; }
  foreach($view->field as $index => $data) {

Comments

nexxer’s picture

Thanks irakli, this fixed it for me

Alan Oliveira’s picture

Title: i18nTaxonomy Module Throws an Error » problem solved
Assigned: Unassigned » Alan Oliveira

thanks!
it works just fine add this code on line 578 =)

Alan Oliveira’s picture

Title: problem solved » i18nTaxonomy Module Throws an Error
Assigned: Alan Oliveira » Unassigned
jose reyero’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

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