I got error message, "Invalid argument supplied for foreach() on /var/www/html/includes/menu.inc in line 743"

After that I noticed that some of the terms in menu are duplicated (check the screenshot)
The menu rebuilding checkbox doesn't help.

CommentFileSizeAuthor
#22 taxonomy-structure.png28.91 KBJean-Philippe Fleury
#5 taxonomy_structure.png6.96 KBAnonymous (not verified)
#1 Clipboard02.jpg34.15 KBrestyler
Clipboard02.jpg36.31 KBrestyler

Comments

restyler’s picture

StatusFileSize
new34.15 KB

wrong file attached, here is the correct one

nyl_auster’s picture

i have also a lot of dupplicatas... Maybe because i tried to hook with my own custom path but my code seems to be ok. I desactivated my module but no matters how many times i flush the cache and build the menu : i got a lot of dupplicata each times...

nyl_auster’s picture

Ok, i saw that the webmaster has set terms that have several parents; in this cas it seems that's taxonomy menu repeat in each categorie 3 times a term if he has 3 parents (sorry for my bad english)

indytechcook’s picture

Status: Active » Postponed (maintainer needs more info)

@restyler Can you please provide me your taxonomy structure or a small sample of it?

Anonymous’s picture

Title: Duplicates of terms » Duplication of terms
Version: 6.x-2.3 » 6.x-2.x-dev
Status: Postponed (maintainer needs more info) » Active
StatusFileSize
new6.96 KB

Marked issue #536118: Duplicate menu items as duplicate of this one, I'm experiencing the same problem.

The warning I referred to related to a custom block I have, but which didn't seem to affect Taxonomy Menu in any way... However after seeing restyler's foreach() error, I'm wondering whether an 'invalid argument supplied for foreach()' triggers it somehow...?

I've attached a screenshot of my taxonomy structure, the same one in the screenshot in my other issue.

Anonymous’s picture

I went into the database after my last post and deleted all duplicate menu entries. Everything was back to normal, except that it just started happening again this morning.

Needing urgent help with this!

Anonymous’s picture

Priority: Normal » Critical

Using the 'Select to rebuild the menu on submit' feature successfully gets rid of the duplicate items from the taxonomy menu, but they get placed at the end of the main menu (primary menu, etc.) as children of the last menu item...

For example:

Before rebuild:

Room Type
- Luxury
- Mid-range
- Budget
- Budget
- Budget
- Budget
Other menu items
Last item

After rebuild:

Room Type
- Luxury
- Mid-range
- Budget
Other menu items
Last item
- Budget
- Budget
- Budget
Alex Andrascu’s picture

subscribing

BayouBill’s picture

I'm having this problem as well, with a pretty plain-vanilla install. No errors are thrown in my case, but the duplicates are displayed in the menu. See http://drupal.org/node/558530#comment-1972528 (image #6 shows the duplicates). I have examined my term_hierarchy table and confirmed that it does not contain any duplicate entries.

Follow-up:
1. Disabled and uninstalled taxonomy_menu
2. Verified that all related database entries and table had been removed, based on what is in taxonomy_menu.install
3. Verified using current version (6.x-2.3 under Drupal 6.13)
4. Re-enabled Taxonomy Menu and Taxonomy Menu Custom Path modules
5. Edited Vocabulary and rebuilt menu
6. Duplicate appeared immediately, just as in above-referenced image

It appears this must have something to do with the menu-building process.

TRex2003’s picture

subscribing

Rayrunner’s picture

Subscribing

indytechcook’s picture

I"m working on this and issue #426304: [NOT SOLVED] Hierarchical menu, NOT expaning to current term on and off for the next few hours. I'll be on IRC if anyone wants to assist. indytechcook

indytechcook’s picture

After hours of debugging and research, it seems these are linked to issues with the core menu system.

#550254: Menu links are sometimes not properly re-parented
#149562: Menu module causes duplicate menu items
#566094: menu_tree_data() doesn't build proper hierarchy

Some of the times say they are for D7 but also apply for D6. I haven't tested any of the patches yet.

nally’s picture

at this time, if I have a flat taxonomy, do you recommend this module or the previous non-beta?

THANKS!

indytechcook’s picture

According to the usage stats, nearly 700 sites have installed the new beta. There are a lot of good features and fixes in it. It's released as beta due to the number of changes that haven't been tested together.

I would use the new beta (of course testing your workflow).

indytechcook’s picture

For thosing having this issue. Does this fix it? http://drupal.org/node/149562#comment-1969614

I've been unable to reproduce.

A side note that taxonomy menu does not support terms with multiple parents yet. There is some code being worked here #498182: Support for a term with multiple parents

not_skjalf’s picture

Subscribing

elprans’s picture

indytechcook’s picture

This has been commited. Please look for the dev release soon. If it fixes the issue, then please post here and I will add a new stable release.

Thanks again to elprans for fixing this long standing issues.

indytechcook’s picture

Status: Active » Needs review

change status.

Jean-Philippe Fleury’s picture

subscribing

Jean-Philippe Fleury’s picture

StatusFileSize
new28.91 KB

Hi,

I updated to the dev release (6.x-2.x-dev, 2009-Oct-29), I cleared the Drupal cache and I rebuilt the menu on submit, but I still have this bug. See the attached screen shot of my taxonomy structure and my menu.

indytechcook’s picture

Do you have i18n setup? if so have you installed the patch from this issue: #316632: Integrate with I18n (I) - "Localize terms" or #498786: Integrate with i18n (II) - Solution for "Per language terms"

indytechcook’s picture

Version: 6.x-2.x-dev » 6.x-2.4-beta2

This patch is part of 6.x-2.4-beta2. Please upgrade to that version and place this issue into RTBC if it works. I can't not release the next stable until this is resolved.

Jean-Philippe Fleury’s picture

No, I didn't install the module i18n.

Jean-Philippe Fleury’s picture

I've just updated to 6.x-2.4-beta2, and now my Drupal installation crashes:

Fatal error: Cannot redeclare _taxonomy_menu_term_count() (previously declared in /var/www/html/sites/all/modules/taxonomy_menu/taxonomy_menu.database.inc:130) in /var/www/html/sites/all/modules/taxonomy_menu/taxonomy_menu.database.inc on line 144

arlinsandbulte’s picture

I can confirm the fatal error in 6.x-2.4-beta2.
It looks like the function was duplicated and modified, but the original function was not deleted.

See this commit: http://cvs.drupal.org/viewvc/drupal/contributions/modules/taxonomy_menu/...

Removing the first function at least returns the site to a usable state:

/**
 * used to get the count without children
 * 
 * @param $tid
**/

/** REMOVE THIS FUNCTION **
 * function _taxonomy_menu_term_count($tid) {
 *   return db_result(db_query(db_rewrite_sql('SELECT COUNT(n.nid) AS c FROM {term_node} t INNER JOIN {node} n ON t.vid = n.vid WHERE n.status = 1 AND t.tid = %d'), $tid));
 * }
**/

function _taxonomy_menu_term_count($tid) {
  $view = views_get_view('taxonomy_term');
  if(is_object($view)){
$args = array($tid);
$view->set_arguments($args);
$view->execute_display('page', $args);
return $view->total_rows;
  } else {
return db_result(db_query('SELECT COUNT(n.nid) AS c FROM {term_node} t INNER JOIN {node} n ON t.vid = n.vid WHERE n.status = 1 AND t.tid = %d', $tid));
  }
}
indytechcook’s picture

Sorry. See beta 3.

Jean-Philippe Fleury’s picture

I've updated to beta3. I no longer have the fatal error, but I still have the bug about duplication.

arlinsandbulte’s picture

jpfle:
What if you UNINSTALL the taxonomy menu module, and then reinstall it?
By this, I mean disable the module AND then go to /admin/build/modules/uninstall and uninstall Taxonomy Menu.

Warning!
This will erase all taxonomy menu settings from the database. After reinstalling, you will need to reconfigure all of your Taxonomy Menu settings from scratch!

Jean-Philippe Fleury’s picture

Status: Needs review » Reviewed & tested by the community

I did it, and it fixed the bug! Thanks a lot! :-)

arlinsandbulte’s picture

Status: Reviewed & tested by the community » Fixed

Great!
Let's hope it does not show up again.

Status: Fixed » Closed (fixed)

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