Project:Taxonomy Browser
Version:6.x-1.2
Component:Code
Category:support request
Priority:normal
Assigned:NancyDru
Status:closed (fixed)

Issue Summary

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

#1

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.

#2

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

#3

Great, thanks for the update.

#4

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.

#5

Assigned to:Anonymous» 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');
    }

#6

Status:postponed (maintainer needs more info)» fixed

This change has been committed.

#7

Status:fixed» closed (fixed)

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