Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have a CCK Content Taxonomy Field whose values are additionally saved to core taxonomy.
My vocabulary's display option is set to "None (hidden)". Node preview throws the following error:
Invalid argument supplied for foreach() in /var/www/drupal/sites/all/modules/term_display/term_display.module on line 164.
I am not into coding: a software developer suggested replacing "isset" with "is_array" in line 155
to handle nodes with no taxonomy terms assigned to them.
Comments
Comment #1
rstamm CreditAttribution: rstamm commentedCan't reproduce, need more info about field settings.
Comment #2
AlexisWilke CreditAttribution: AlexisWilke commentedskizzo,
Did you mean "Content Taxonomy"? (and not CCK Content Taxonomy Field since the latter is not available for D6)
Can you please share the setup you have with that CCK field? That way we may be able to replicate the problem.
Thank you.
Alexis
Comment #3
skizzo CreditAttribution: skizzo commentedYes, "Content Taxonomy". After all the error may be unrelated to Term Display, or it could be module interaction. I have two vocabularies assigned to my Content Type.
I can now create, preview and save a node without any error report (for the sake of testing I disregard the two vocabulary input form elements, I only use the Content Taxonomy field). I now enable a separate auto-tagging module, which adds a "Hide vocabulary in input form" option to all vocabularies.
If I now try to create content, select Content Taxonomy Field, and click on Preview, the system throws:
The first error disappears applying the line 155 fix described in OP (other errors are still there).
All three errors disappear disabling the autotagging module
Comment #4
AlexisWilke CreditAttribution: AlexisWilke commentedThere is a suspicious line of code in content_taxonomy, to my point of view.
The following creates an empty entry.
The comment is correct that if there isn't anything (no taxonomy) then the taxonomy module is not going to save anything and thus deletion won't work. However, the NULL is of the wrong type and I think that's what generates the problem. Yet, I could not reproduce the errors you are seeing... So there could be yet another module that tweaks the $node->taxonomy field.
P.S. I do an update as I mentioned the wrong module in my post (i.e. I was blaming Term Display instead of Content Taxonomy...)
Comment #5
AlexisWilke CreditAttribution: AlexisWilke commentedSkizzo,
I did some more testing, but the Content Taxonomy potential problem does NOT occur when you just Preview a page. So the problem must be somewhere else...
Are you sure that the three modules you mentioned here are the only ones that deal with terms and taxonomies?
Could you search your list of modules for
->taxonomy
and see whether you have another module that could be tweaking that variable...Thank you.
Alexis Wilke
Comment #6
skizzo CreditAttribution: skizzo commentedI disabled a couple of taxonomy related modules (Taxonomy Manager and Taxonomy Image) to no avail. I do not understand why the error shows up only with Preview... If I create and save the node right away, without any preview, then there is no error, so it has something to do with the way Preview works. I could send you the export of my Content Type, if that helps reproducing the issue... Thanks.
Comment #7
AlexisWilke CreditAttribution: AlexisWilke commentedCould you tell us what version you are using for the following modules (I put my current version between parenthesis):
Drupal (6.13)
MO Auto add terms (1.4)
Content Taxonomy (1.0-rc1)
Term Display (1.x-dev)
Thank you.
Alexis
Comment #8
skizzo CreditAttribution: skizzo commentedDrupal (6.13)
MO Auto add terms (1.4)
Content Taxonomy (1.x-dev 2009-07-16)
Term Display (1.x-dev 2009-06-19)
Comment #9
AlexisWilke CreditAttribution: AlexisWilke commentedOkay... I tested with Content Taxonomy 1.x-dev and still no error...
I wanted to create another site, so I could try to only install these few modules and see whether I get the error...
More later.
Alexis Wilke
Comment #10
skizzo CreditAttribution: skizzo commented@Alexis: to play it safe I decided to simplify my setup, so I don't get the error anymore. I leave this issue open as a reminder in case you want to figure out what the problem was. Feel free to close in case you cannot reproduce it. Thx.
Comment #11
AlexisWilke CreditAttribution: AlexisWilke commentedWhat did you remove to not get the error anymore? 8-)
Thank you.
Alexis
Comment #12
skizzo CreditAttribution: skizzo commentedwell, the settings for the autotagging vocabulary (TAGS in #3) is actually the same. I simplified the setup by not using Content Taxonomy for the other vocabulary (SECTION in #3) and I haven't seen the error since then. I am closing this issue as now I cannot follow up anymore. Will re-open if I stumble into it again.