I have been trying to resolve this error that I've been getting for some time and have finally figured it out so I wanted to share it with others. I was unable to find a post on the forums or elsewhere that resolved my particular problem.
warning: Invalid argument supplied for foreach() in [path to]/modules/taxonomy/taxonomy.module on line 1241.
I wrote a basic module that just checked nodes, node_revisions, taxonomy and users. It turns out that the majority of my "warnings" were from referencing a user.uid in the node and node_revisions table that did NOT exist in the user table.
Due to importing multiple Wordpress blogs and other content a number of users were created and then deleted from the users table to "clean things up" (as in someone went into phpadmin and deleted those rows with that uid). Over time this caused problems, especially when (re)indexing with the Solr module.
The module report I wrote compared nodes and the nodes loaded up using node_load. The majority of the warnings were resolved by just recreating an account with that user id (uid) in phpmyadmin and assigning it the missing uid. I think updating both the nodes and node_revisions table to a valid user's iud would work but I didn't want to take the risk of corrupting something else, hence recreating the deleted account.