how to reproduce it:
- create a vocabulary, non required, (either multiple or not), but no tags, let the <select> come up with a "none" option
- create a node, enter some term for that vocabulary
- edit the node, select the option "none", and request preview

warning: Invalid argument supplied for foreach() in /.../modules/taxonomy/taxonomy.module on line 70.

the problem comes when node_form_build_preview build a faked node from $form_state['values'] which ends up in taxonomy module looking for an empty string as if it would be a free tag, and it was not

        if (is_object($term)) {
          ...
        }
        // Previewing free tagging terms; we don't link them because the
        // term-page might not exist yet.
        else {
          foreach ($term as $free_typed) {
            ...

Comments

hgmichna’s picture

Another way to reproduce it may be to upgrade to Drupal 6.16. At least on one of my Drupal installations that did the trick.

The message comes up, 21 times, when I update a forum topic. Vocabularies are not knowingly involved—there are none in this case, apart from the fact that there are forums.

Any ideas what I can do to repair this defect?

Addendum 2010-03-14 – The number of error messages is slowly rising. I now get about 30 of them, all identical, every day about two more. Still no idea how this can be fixed? I'm not a PHP programmer and I don't understand the description (above) of the error.

arhak’s picture

the root cause for your errors might be located at the same spot, but it might be due to other path reaching the same point

my advise: sit tight, it might take some time before other users complain about this same error
try looking support in the forums or in other issues related to upgrade path from 6.15 to 6.16 (I have seen a few of them)

there has to be more users having issues upgrading forums, try to bring their attention to this issue

BTW, these are just suggestions, since I'm the only one listening right now, and (by now) I won't fix it

hgmichna’s picture

Version: 6.15 » 6.16

Thanks! I'm wondering how many Drupal operators are affected. If not most, then why are some affected and some not?

Anyway, I will do precisely what you recommended.

Addendum 2010-03-14: I have added two lines (the first and the last, each containing "$errorreporting") to the code as a stopgap measure to suppress the warnings:

<?php
          $errorreporting = error_reporting(0);
          foreach ($term as $free_typed) {
            $typed_terms = drupal_explode_tags($free_typed);
            foreach ($typed_terms as $typed_term) {
              $links['taxonomy_preview_term_'. $typed_term] = array(
                'title' => $typed_term,
              );
            }
          }
          error_reporting($errorreporting);
?>

I don't understand the PHP code well enough, however, to judge whether the defect itself or my workaround has any bad side effects. If anybody knows a safer, better workaround, please let us all know.

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.