Taxonomy Browser Error message

izmeez - June 9, 2008 - 18:09
Project:Taxonomy Browser
Version:6.x-1.2
Component:Code
Category:support request
Priority:normal
Assigned:NancyDru
Status:closed
Description

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

#1

NancyDru - June 9, 2008 - 18:56
Status:active» 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

izmeez - June 10, 2008 - 13:06

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

NancyDru - June 10, 2008 - 13:37

Great, thanks for the update.

#4

random_ - July 9, 2008 - 18:52
Status: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

NancyDru - July 9, 2008 - 22:13
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

NancyDru - August 14, 2008 - 14:30
Status:postponed (maintainer needs more info)» fixed

This change has been committed.

#7

Anonymous (not verified) - August 28, 2008 - 14:33
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.