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.

Comments

ErwanF’s picture

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.

mh86’s picture

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?

cbow’s picture

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.

mh86’s picture

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

mh86’s picture

updated my drupal installation and still not getting any error
maybe it has been fixed with this issue (fixed today)

ErwanF’s picture

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.

ErwanF’s picture

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).
Only local images are allowed.
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?

skizzo’s picture

@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.

rwd’s picture

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:

  1. Create a new content type
  2. Add a content taxonomy field to the new content type
  3. Configure that field to use one of the options widgets, e.g. Select List, and enable the option "Save values additionally to the core taxonomy system".
  4. Create, preview and save a new node of this content type (should preview and save fine)
  5. Edit the node and hit Preview. This should get you the "illegal offset type" error message(s)
no2e’s picture

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.
rwd’s picture

Following up on my previous comment #9, further investigation suggests that these warnings will not be displayed if you:

  • associate another taxonomy vocabulary with your content type; and
  • do not add that vocabulary to the content type's list of fields (by means of content_taxonomy's CCK fields).

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.

ntt’s picture

subscribing

ErwanF’s picture

Assigned: ErwanF » Unassigned

Thanks, Richardwdoe. That's exactly what I found and tried to explain in #7 ;-)

mh86’s picture

Status: Active » Fixed

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 ;)

ErwanF’s picture

Thanks a lot for this work!

fletch11’s picture

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.

malc_b’s picture

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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

aidanlis’s picture

Version: 6.x-1.0-beta6 » 6.x-1.x-dev
Status: Closed (fixed) » Active

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.

pepe roni’s picture

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.

crea’s picture

Subscribing...downloaded latest CT, and problem is still there..

crea’s picture

Title: "Illegal offset type in" warnings on node preview. » "Illegal offset type in" warnings on node preview with Content Taxonomy Options (Option widgets) activated
Component: Code » Option Widgets
Priority: Normal » Minor

@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:

if (!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:

if (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 then we should too, but currently same code runs in CT function.

crea’s picture

Priority: Minor » Normal
crea’s picture

Title: "Illegal offset type in" warnings on node preview with Content Taxonomy Options (Option widgets) activated » "Illegal offset type in" warnings on node preview.
Version: 6.x-1.x-dev » 6.x-1.0-rc1
Component: Option Widgets » Code

This happens not only with Options widget.

mh86’s picture

Title: "Illegal offset type in" warnings on node preview. » "Illegal offset type in" warnings on node preview with Content Taxonomy Options (Option widgets) activated
Version: 6.x-1.0-rc1 » 6.x-1.x-dev
Component: Code » Option Widgets

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.

mh86’s picture

Title: "Illegal offset type in" warnings on node preview with Content Taxonomy Options (Option widgets) activated » "Illegal offset type in" warnings on node preview.
Version: 6.x-1.x-dev » 6.x-1.0-rc1
Component: Option Widgets » Code

accidentally changed issue settings with previous comment..

rwd’s picture

Status: Active » Fixed

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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

merilainen’s picture

Version: 6.x-1.0-rc1 » 6.x-1.x-dev

In my dev-version from Sep 13th I still get this error.

merilainen’s picture

Status: Closed (fixed) » Active

and active

fletch11’s picture

me too... sorry

roderik’s picture

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 ;) )

zoo’s picture

Me too experiencing the problem with drupal6.15 / content taxonomy 6.x-1.0-rc2
I'm not an expert of php, I just flag the error I'm having and paste bottom the warnings I get.
Thank you, zoo

    * warning: Illegal offset type in isset or empty in ***\modules\taxonomy\taxonomy.module on line 1011.
    * warning: Illegal offset type in ***\modules\taxonomy\taxonomy.module on line 1012.
    * warning: Illegal offset type in ***\modules\taxonomy\taxonomy.module on line 1015.
    * warning: Illegal offset type in ***\modules\taxonomy\taxonomy.module on line 591.
    * warning: Illegal offset type in isset or empty in ***\modules\taxonomy\taxonomy.module on line 1011.
    * warning: Illegal offset type in ***\modules\taxonomy\taxonomy.module on line 1012.
    * warning: Illegal offset type in ***\modules\taxonomy\taxonomy.module on line 1015.
    * warning: Illegal offset type in ***\modules\taxonomy\taxonomy.module on line 591.
Hobbes-2’s picture

Subscribe

cerup’s picture

Title: "Illegal offset type in" warnings on node preview with Content Taxonomy Options (Option widgets) activated » "Illegal offset type in" warnings on node preview.
Component: Option Widgets » Code
Priority: Minor » Normal

Same thing here...can we get a final commit to the fix for this? If it was fixed in the past, why is that not being committed?

mh86’s picture

patch from #552874: php undefined variable notices committed, this should fix this issue again.
please check out the latest dev version and give me some feedback if everything works

zoltán balogh’s picture

subscribe

ari-meetai’s picture

Status: Active » Reviewed & tested by the community

Confirmed as fixed for my installation with -dev.

Drupal 6.15
PHP 5.2.6

temp’s picture

I have same error on preview with latest dev version.

bserem’s picture

problem appears in d6.16 and latest -dev in my site too

jbomb’s picture

Confirming #40 issue persists in Drupal 6.16 and content_taxonomy-dev as of 28 May 2010.

jbomb’s picture

Status: Reviewed & tested by the community » Needs work
jbomb’s picture

Status: Needs work » Reviewed & tested by the community

hold on, i need to take my foot out of my mouth. The -dev version does resolve this issue for me.

zeezhao’s picture

subscribing. Seen this issue in dev version w/ drupal 6.16, in conjuction with hierarchical_select-6.x-3.1.tar.gz

zeezhao’s picture

Status: Reviewed & tested by the community » Active

Posted the issue I am seeing here: http://drupal.org/node/815796

Please confirm if the patch is in the latest dev version. Thanks

jbomb’s picture

I can confirm that the -dev version (as of 3 June 2010) resolves the following error in Drupal 6.16. I received the error when submitting a node for preview. The dev version resolved this issue for me on two sites.

<pre>
warning: Illegal offset type in isset or empty in .../modules/taxonomy/taxonomy.module on line 1023.
warning: Illegal offset type in .../modules/taxonomy/taxonomy.module on line 1024.
</pre>
my-family’s picture

I experienced the same problem and can confirm that 6.x-1.x-dev (release form 2010-Apr-08) fixed it, thanks.

magnus’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)
Issue tags: -checkbox, -option, -options, -widget

Automatically closed -- issue fixed for 2 weeks with no activity.