Could someone help in the understanding of why this error message is displayed when the taxonomy browser is used and what can be done to correct it.

warning: Invalid argument supplied for foreach() in /sites/all/modules/taxonomy_browser/taxonomy_browser.module on line 309.

Thanks,

Izzy

Comments

nancydru’s picture

Status: Active » Closed (duplicate)

Apparently your version of the code and mine differ, since there is no foreach at that line in my code. I believe you are seeing either the same as http://drupal.org/node/265436 or you have no vocabularies defined or selected for the module. In either case, the current -dev version should fix it. If not, please re-open this issue.

izmeez’s picture

I disabled the taxonomy browser module, uninstalled it, then enabled it again and the problem was resolved. I have not tried the updated dev version.

Thanks,

Izzy

nancydru’s picture

Great, thanks for the update.

random_’s picture

Status: Closed (duplicate) » Active

Hi,

I am also getting this error:
warning: Invalid argument supplied for foreach() in /var/www/html/drupal5/sites/all/modules/taxonomy_browser/taxonomy_browser.module on line 345.

I have Categories 5.x-1.x-dev and Taxonomy Browser 5.x-1.x-dev (2008-Jun-27).
I have selected a taxonomy/container but it just reduced the number of duplicate warnings to one.
Strangely, if I select more than one taxonomy in settings I get more than one warning.

The dev version doesn't fix it for me.
I also tried disabling, uninstalling and reinstall and it still didn't go away.

nancydru’s picture

Assigned: Unassigned » nancydru
Status: Active » Postponed (maintainer needs more info)

I don't know anything about the Categories module, nor have any idea if TB will work with it. I support only the core Taxonomy module.

Your error would indicate that a vocabulary is not associated with any content types. However, I have created a vocabulary with no content types and cannot reproduce this. I suspect that Categories is not even building the vocabulary object correctly.

Please change the current little loop there with this:

    if (isset($voc->nodes) && !empty($voc->nodes[0])) {
      foreach ($voc->nodes as $key => $type) {
        $voc_node_types[] = $node_types[$type];
      }
    }
    else {
      drupal_set_message(t('The %name vocabulary does not appear to be associated with any content types.', array('%name' => $voc->name)), 'error');
    }
nancydru’s picture

Status: Postponed (maintainer needs more info) » Fixed

This change has been committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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