"Illegal offset type in" warnings on node preview.
This is my first bug report on Drupal and furthermore I'm french so I hope I'm doing this correctly. I'm working with Drupal 6.9 on a local installation. If the Content Taxonomy Options module is activated, I get the same following lines repeated many times on a preview of a Übercart product class node :
"# warning: Illegal offset type in isset or empty in C:\wamp\www\XXXX\modules\taxonomy\taxonomy.module on line 1015.
# warning: Illegal offset type in C:\wamp\www\XXXX\modules\taxonomy\taxonomy.module on line 1016.
# warning: Illegal offset type in C:\wamp\www\XXXX\modules\taxonomy\taxonomy.module on line 1019.
# warning: Illegal offset type in C:\wamp\www\XXXX\modules\taxonomy\taxonomy.module on line 592."
When published anyway, some Taxonomy terms added through CCK fields vanished. This trouble disapears when I unactivate this particular module. I use many modules but I can give a complete of partial list if needed.

#1
Erratum
- I made a confusion between two modules. The module I am talking about is CT Options, not Option widgets.
- "When published anyway, some Taxonomy terms added through CCK fields vanished." After a new check, this is not exact. Terms disapear if the module is unactivated, which sounds more logical.
#2
maybe it's a conflict with the ubercart module.
do you get the same error messages with a different own content type and content taxonomy fields?
#3
I was getting the same message (no Ubercart). It started after upgrading from d6.9 to d6.10. I "solved" to problem by going into the CT field for my content-type then unchecking the "Save values additionally to the core taxonomy system (into the 'term_node' table)." option, saving, re-checking, saving.
#4
thanks for this information. I'm still running drupal 6.8 on my local installation.
I'm going to update my installation and check this issue again
#5
updated my drupal installation and still not getting any error
maybe it has been fixed with this issue (fixed today)
#6
I didn't try with another content type. Actually I wonder if it is a trouble with Taxonomy Image and/or PathAuto modules. This was temporarly "Solved" by not using a CCK Taxonomy field to display an image from Taxonomy image and unactivating PathAuto for the moment. I'm obviously new in Drupal community and still have trouble to fully understand Taxonomy image module... I'm sorry if this doesn't sound very clear. I will try to do better next time... Anyway thanks for your replies.
#7
Back and going on trying to find the answer. This issue occurs on another of my content types too, though this one isn't linked at all with Übercart.
You must know that I want to display all the terms associated with this content type on this content type by using CCK fields (because I don't like the default taxonomies' display). As a result, the area named "vocabularies" become empty on my content type edit page (see my attachment, with this "vocabularies" area in French).
But according to my latest trials, this can't be empty, otherwise I get this precise following message again (x 5):
* warning: Illegal offset type in isset or empty in C:\wamp\www\dkpd\modules\taxonomy\taxonomy.module on line 1015.* warning: Illegal offset type in C:\wamp\www\dkpd\modules\taxonomy\taxonomy.module on line 1016.
* warning: Illegal offset type in C:\wamp\www\dkpd\modules\taxonomy\taxonomy.module on line 1019.
* warning: Illegal offset type in C:\wamp\www\dkpd\modules\taxonomy\taxonomy.module on line 592.
The string talking about a "line 1015" may miss a content in this precise area. So I created a test vocabulary named "trial", I populated it with two terms, "trial 1" and "trial 2", then I associated this vocabulary with this buggy content type, in order to have something in the "vocabularies" area (obviously not displayed anywhere else with a CCK field). Now it works fine (no warning anymore on my preview page)! But since I display those test terms in a CCK field (leaving the vocabularies area empty again), I get the same issue. Now I know that I need some content in this vocabularies area. So I think I will delete my last CCK field, keep this test taxonomy and hide it using the Taxonomy Hide module... Any better idea?
#8
@mh86 Re #5 : I don't think that http://drupal.org/node/395328 solves this issue.
I upgraded from 6.x-1.0-beta6 to 6.x-1.x-dev 2009-03-17 but I still see the error. I have a simple content type with
- a Content Taxonomy CCK field, Select List widget type, nested in Standard Group, configured for vid 4- vocabulary 4 is NOT directly assigned to my content type in admin/content/taxonomy/edit/vocabulary/4
Going into node editing, when clicking on preview I get the error
warning: Illegal offset type in isset or empty in /var/www/drupal/modules/taxonomy/taxonomy.module on line 1015.If I now create a vid 5 and assign it to content type via admin/content/taxonomy/edit/vocabulary/5 then preview is ok, no error.
I could assign vid 4 as both Content Taxonomy field AND direct vocabulary assignment, but I assumed that this would
be a bad practice... is that assumption wrong? Thank you.
#9
The same issue has been encountered here with Drupal 6.10, CCK 6.x-2.2 and Content Taxonomy 6.x-1.x-dev (2009-Mar-17).
To reproduce it:
#10
Same issue for me -- did the same as richardwdoe described in #9.
* warning: Illegal offset type in isset or empty in /www/htdocs/XXX/XXX/drupal/modules/taxonomy/taxonomy.module on line 1015.* warning: Illegal offset type in /www/htdocs/XXX/XXX/drupal/modules/taxonomy/taxonomy.module on line 1016.
* warning: Illegal offset type in /www/htdocs/XXX/XXX/drupal/modules/taxonomy/taxonomy.module on line 1019.
* warning: Illegal offset type in /www/htdocs/XXX/XXX/drupal/modules/taxonomy/taxonomy.module on line 592.
#11
Following up on my previous comment #9, further investigation suggests that these warnings will not be displayed if you:
In other words, if you have at least one vocabulary associated with the content type that is not handled by content_taxonomy, you will not get the warnings.
#12
subscribing
#13
Thanks, Richardwdoe. That's exactly what I found and tried to explain in #7 ;-)
#14
Hi!
Finally I was able to reproduce the problem (thanks to the detailed descriptions). The Taxonomy module was throwing the warnings on preview because of a wrong format in $node->taxonomy. This happened when every core taxonomy field got hidden. I think this problem already existed for a longer time, at least since some Content Taxonomy versions.
The problem was quite hard to debug, but I think I found a working fix (a bit strange, but ok). I committed the changes to the dev version. So, when trying the fix, be sure to have the right version. Fix will be included in the next release anyway ;)
#15
Thanks a lot for this work!
#16
not sure if this was committed to the latest (May 17) release but I'm still getting these errors as well.
thanks for all your work.
#17
I was getting this but the mode I have in taxonomy fixes this. This has been reported as a taxonomy issue but isn't fixed. See http://drupal.org/node/275352#comment-1422794 for my solution. If you add
drupal_set_message("<pre>" . print_r($tid, true) . "</pre>");to taxonomy just be line 1011 if (!isset($terms[$tid])) you can see the majority have $tid as numeric but some are complete objects.
#18
Automatically closed -- issue fixed for 2 weeks with no activity.
#19
I've just checked out the latest branch, DRUPAL-6--1, and I'm still getting the same errors. See http://drupal.org/node/275352 for related issues.
#20
Having same problem with 6.x-1.x-rc1.
Content Taxonomy writes taxonomy terms to core database, option widgets activated (but does not matter). Preview mode throws the described errors.
I use Content Taxonomy to have a per node type restriction / representation for taxonomy terms. In one node type it is allowed to add terms, in another node type it is not. In one node type you have single selection, in another node type you have multiple selection. I can not do without this module.
#21
Subscribing...downloaded latest CT, and problem is still there..
#22
@mh86: I found error with your patch: in form_alter hook you seem to unset $form['taxonomy'] while you should actually work with $form['#node']->taxonomy (as taxonomy code which is causing preview problems). Also, at the beginning of the funcion you make following check:
<?phpif (!is_array($form['taxonomy'])) {
return;
}
?>
and I checked that during preview $form['taxonomy'] is empty so function simply terminates at the beginning because of this check.
If I understand it correctly, during preview whole node object is prepared in $form['#node']. If I simply enter at the beginning following code:
<?phpif (isset($form_state['node_preview'])) {
unset($form['#node']->taxonomy);
}
?>
then preview works without errors ( but it's ofcourse not solution, cause it disables normal non-CT vocabs too, I think).
So my conclusion: seems like entire content_taxonomy_form_alter() function needs major rework. Those $form_state's seem to be tricky and require good understanding of what is happening deep and what needs to be done. If taxonomy code behaves differently in different $form_states than we should too, but currently same code runs in CT function.
#23
#24
This happens not only with Options widget.
#25
I added another few lines to prevent an empty taxonomy form array on preview. it seems like this fixes the warnings for me. I hope this is working now.
#26
accidentally changed issue settings with previous comment..
#27
Going through the same steps I detailed in comment #9 with the dev versions dated 2009-Jul-16 and 2009-Aug-12, this issue looks to be fixed in both.
Thanks mh86.
#28
Automatically closed -- issue fixed for 2 weeks with no activity.
#29
In my dev-version from Sep 13th I still get this error.
#30
and active
#31
me too... sorry
#32
It seems this was 'unfixed' in #552874: php undefined variable notices. The patch in #4 of that issue, fixes things for me.
@crea / #22: I have spent some hours debugging this and was thinking exactly the same as you. However, apparently mh86's changes do fix everything (and make sure that taxonomy_preview_terms() isn't called unnecessarily? I'm too tired of this to re-check that ;) )