During cron runs, I sometimes get a watchdog error like:

Message	
Invalid argument supplied for foreach() in /home/site/public_html/modules/taxonomy.module on line 1184.

I think this is due to my use of taxonomy_access which rewrites the taxonomy selction query in node_load(), etc.

Attached patch adds an if clause around the foreach(). This patch works to eliminate the watchdog errors during cron runs.

Also fixes taxonomy_nodeapi to use pass-by-reference as per Drupal API (just noticed this while tracking the other error).

CommentFileSizeAuthor
taxonomy_foreach_patch0.txt831 bytespwolanin

Comments

Alex Schenkman’s picture

I get the same error but I don't use taxonomy_access, I use og.
Any hints on how to fix it?

Thanks!

pwolanin’s picture

If you're getting exactly the same error message, then I would think that applying the patch above will prevent the error from occuring. It may be a side effect of various access control schemes (including OG), not just TAC.

drumm’s picture

Status: Needs review » Needs work

The way to fix these bugs (in almost all cases) is to make sure the $node->taxonomy variable is properly initialized as an array (... = array();)

pwolanin’s picture

@drumm - is there somewhere else to look to change the code to insure this initialization? For example, in taxonomy_nodeapi?

pwolanin’s picture

Version: 4.7.2 » 4.7.x-dev
Status: Needs work » Closed (fixed)

I'm not seeing this error any longer