Reproduction process:

Requirements:
Drupal 6.22

Contrib Modules:
NONE

Core Modules:
Forum
Poll

1. Simply DL and install latest (6.22 OR Dev, both exhibit this issue) Drupal
2. Enable both the Poll AND the Forum module
3. Simply add the Forum "Forum" Vocab to the "Poll" Content type
4. Begin to create a new Poll (DONT SAVE IT)
5. Fill in title and the 2 Choice fields
6. Click "Add Another Choice"
7. The errors display in the message area as:
* warning: Illegal offset type in isset or empty in /var/www/html/test_d6_2/modules/taxonomy/taxonomy.module on line 1038.
* warning: Illegal offset type in /var/www/html/test_d6_2/modules/taxonomy/taxonomy.module on line 1039.
* warning: Illegal offset type in /var/www/html/test_d6_2/modules/taxonomy/taxonomy.module on line 1042.
* warning: Illegal offset type in /var/www/html/test_d6_2/modules/taxonomy/taxonomy.module on line 606.

NOTES: This only happens to NEW Poll nodes. If you EDIT a node, this will NOT happen. Also of note, if you create a regular ol' Vocab and attach it to the Poll content type, it will NOT produce this error. This means that somehow the Forum Vocab is different. In either case, the reason this happens is because it's trying to access a node that does not yet exist. This almost seems like a drupal_process_form() is being used somewhere where it's not suppose to be.

BTW, if someone comes along and says "This isnt a Poll issue", explain why (technically) and dont just give general answers. I'm pretty sure this is a Poll issue. My first guess is that its NOT the forum module at fault since it's a Poll feature that causes the error. I believe it's likely not feeding something the proper data when it sees vocabs that it doesnt know how to handle such as a module defined vocab such as the one from Forum. I'd bet other modules that define their own vocabs would also be able to reproduce this error.

Comments

crystaldawn’s picture

After a little bit of digging, I've confirmed that this is indeed the poll module causing the problem and I have found a fix for it.

On line 286 it's trying to build node_form_submit_build_node($form, $form_state); which is in line with my first assumption that this was similar to a drupal_form_process() being used improperly. This indeed turned out to be the case and thus the fix was rather simple. For some reason, whenever you add the forum vocab (which is defined by the core forum module) to the poll content type, it starts populating the $form_state['values'] array with an EMPTY $form_state['values']['taxonomy'] array. It only contains the array keys, and no actual values. The taxonomy module gets these values and since they are empty, it displays the warnings I show in the previous post.

The fix for this is to change:

node_form_submit_build_node($form, $form_state);

to

unset($form_state['values']['taxonomy']);
node_form_submit_build_node($form, $form_state);

Once you do this, the warnings go away!!! Whether or not this is the "proper" way to handle this issue, I dont know. But it sure does fix the issue with no adverse affects that I can see. I assume the "Proper" way to fix it would be to make sure that the taxonomy values are not empty. But that will take far to much of my time to figure out and thus I'll leave that to someone else to do. But in the mean time, this fix DOES work.

crystaldawn’s picture

Status: Active » Needs review

O ya, since this fix works, might as well change it to needs review. Duh lol.

Status: Needs review » 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.