When I preview a node where I've set a single or multiple-select taxonomy term, I'm getting these errors:
# warning: Illegal offset type in isset or empty in /var/www/pingVision/modules/taxonomy/taxonomy.module on line 1014.
# warning: Illegal offset type in /var/www/pingVision/modules/taxonomy/taxonomy.module on line 1015.
# warning: Illegal offset type in /var/www/pingVision/modules/taxonomy/taxonomy.module on line 1018.
# warning: Illegal offset type in /var/www/pingVision/modules/taxonomy/taxonomy.module on line 592.
The problem, after looking for a bit, seems to be in taxonomy_link - when it's called the first time for the node on the preview, the node's taxonomy is flat, in an array([20] => 20, [24] =>24) sort of manner. But the second time, the node's taxonomy array is 'normal' - it's array([20] => stdClass(blah blah), [24] => stdClass(blah blah)). In that second case, the call to taxonomy_preview_terms is still made because $node->build_mode == NODE_BUILD_PREVIEW, and then the taxonomy_preview_terms blows up because it tries to run taxonomy_get_term on the stdClass object when it's expecting a term id, not a stdClass.
I've made a patch that fixes this by checking more than just if the build_mode is NODE_BUILD_PREVIEW.
Comment | File | Size | Author |
---|---|---|---|
#52 | taxonomy-275352-patch-d7.patch | 769 bytes | aidanlis |
#51 | taxonomy-275352-patch-d7.patch | 417 bytes | aidanlis |
#50 | taxonomy.patch | 427 bytes | aidanlis |
#33 | taxonomy-D6.patch | 637 bytes | smh67 |
#4 | taxonomy-preview_terms_object_error-20081003.patch | 498 bytes | dman |
Comments
Comment #1
pingvinen CreditAttribution: pingvinen commentedIm still having this problem with preview in Taxonomy 6.4
Comment #2
dman CreditAttribution: dman commentedI'm getting this in 6.4
Last time this happened it seems another module was messing up the array a bit.
http://drupal.org/node/269205
I've just installed ubercart and its 25 associated modules, so it may be any one of them. Tracing... It's an adjustment made to the node object or form somewhere previously, so it's not directly in the callstack...
I'd suggest that drupals APIs get a little more robust to rogue input anyway, so i feel an is_numeric() check in taxonomy_get_term would be in order. I know other folk disagree philosophically, but I think APIs should fail gracefully, even if a module was ported badly.
.dan.
Comment #3
dman CreditAttribution: dman commentedSo far it seems that the $node->taxonomy array contains a term object, not an array as expected. I wonder how that got there and who forgot to cast it...
Actually I like objects for terms more, but the system doesn't ...
Comment #4
dman CreditAttribution: dman commentedAs far as I can tell, taxonomy_preview_terms gets called too many times, casting it from array to object once, then attempts to again, but dies because it already is.
Here's how I catch it.
Comment #5
Anonymous (not verified) CreditAttribution: Anonymous commentedShould be
is_numeric($term) && $term
to handle the possible $term == 0.Comment #6
dman CreditAttribution: dman commentedHm. I see what you are thinking, but not quite.
The error that was being addressed is a nasty php indexing exception triggered by addressing
$taxonomy[$term]
where $term is an object.Where $term is zero, that's not an error, just invalid data.
taxonomy_get_term(0) returns NULL (I'm pretty sure) which doesn't error. But could conceivably later I guess.
It's wrong, so yes it should be fixed if detected.
But will need to be fixed by unset(), not by ignoring it.
Outputting an untouched zero in the term list where an object is required may cause trouble later when
so I guess
however that extra code fixes an issue which has never yet arisen. This OP one has.
(BTW, the error can only be replicated when a vocab is set to single select, required AFAIK)
I'm personally in favor of paranoia ... but if we were to worry about it, that check for zero should be much higher in the chain of events.
Suggestions?
Comment #7
Damien Tournoud CreditAttribution: Damien Tournoud commentedThat's a "we don't babysit broken code" type of issue. You should stop trying to fix the symptom and fix the root cause instead.
Marked as won't fix.
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedWon't fix is a bit strong for errors that appear in Drupal core.
Where do you think the ``root cause'' is?
Unsetting $taxonomy[$term] when $term == 0 is meaningless; the array element value should never be 0 if we test that $term has a value > 0.
Comment #9
Damien Tournoud CreditAttribution: Damien Tournoud commentedThe root cause is in one of the non-core modules messing up with the taxonomy.
The error that appear here is a *symptom*. You should fix the cause. The patch in #4 should not even be considered.
Anyway, I'm reassigning that as a support request and set it back to active, so that we can investigate which module is performing wrong and assign the blame on it =)
Comment #10
dman CreditAttribution: dman commentedI spent over an hour tracing the entire active codebase watching anything that was attempting to change $node->taxonomy
All I could see was that in the course of a submitted node preview, taxonomy_preview() was invoked 3 times, each by which appeared to core callstacks. form_alter (or drupal_alter?) ran twice on the form. NODE_BUILD_PREVIEW was not being set on the $node object.
I couldn't track it down to any contrib, although I'd certainly, and still do suspect one as what triggered this as a side effect. If it were possible to understand the chain of events that leads up to this point, that would be cool. I failed.
You call it babysitting,
I call it not trusting external inputs.
Blindly assuming all data from all sources is valid all the time is not what I would expect from a robust API.
My code style is to fix things in a way that stops the problem from happening again (where practical), rather than just hoping it doesn't. Other folk can differ.
But yes, I'd like to find the cause in the contrib. Because knowledge is good also.
Comment #11
Anonymous (not verified) CreditAttribution: Anonymous commentedYes, I agree. Damien this is a bug in Taxonomy module that has a simple solution. Why are you being so obstinate about this simple patch solution?
Comment #12
pingvinen CreditAttribution: pingvinen commentedAny solution to this yet? I still having this warnings on taxonomy 6.5.
* warning: Illegal offset type in isset or empty in taxonomy.module on line 1015.
* warning: Illegal offset type in taxonomy.module on line 1016.
* warning: Illegal offset type in taxonomy.module on line 1019.
* warning: Illegal offset type in taxonomy.module on line 592.
Comment #13
Damien Tournoud CreditAttribution: Damien Tournoud commented@earnie, dman: taxonomy_preview_terms() should only be called once. That's the problem we need to identify and fix in that issue ticket. Changing "taxonomy_preview_terms()" to hide the error there and think it solved the issue is just burying your head in the sand.
Comment #14
mypharm CreditAttribution: mypharm commentedAny solution to this yet? I still having this warnings on taxonomy 6.5.
* warning: Illegal offset type in isset or empty in taxonomy.module on line 1015.
* warning: Illegal offset type in taxonomy.module on line 1016.
* warning: Illegal offset type in taxonomy.module on line 1019.
* warning: Illegal offset type in taxonomy.module on line 592.
or should i burying ny head in the sand?
thanks
Comment #15
Anonymous (not verified) CreditAttribution: Anonymous commentedI suggest you "bury your head in the sand" for the time being and apply the patch or a modification of it from #4.
Can you identify for us the modules you have active?
Comment #16
mypharm CreditAttribution: mypharm commentedMy enabled modules are :
Do you want the core modules also ? I would like to help...
thanks for the reply
Comment #17
Anonymous (not verified) CreditAttribution: Anonymous commentedDo the errors go away if you disable Taxonomy Access Control? Do others having this issue have Taxonomy Access Control enabled?
Comment #18
dman CreditAttribution: dman commentedOMG. I had absolutely zero of those modules present when I got the error. That's a worry. :-{
Comment #19
atiras CreditAttribution: atiras commentedI have this same problem; the only modules I have enabled that are also on your list are:
Views 6.x-2.1, Views exporter 6.x-2.1, Views UI 6.x-2.1 and Advanced Help 6.x-1.1.
I can also say that I didn't have the error messages showing up until 26/10/2008, after I upgraded to Views 6.x-2.1 (on 21/10), installed Advanced Help (also 21/10) and then upgraded to drupal core 6.6 on 23/10.
Simplistically, this looks to me like an interaction between Views 6.x-2.1 and Drupal 6.6. Although others have been seeing it in earlier versions of Drupal core... so maybe an interaction between Views 2 and Drupal.
Comment #20
mypharm CreditAttribution: mypharm commentedHi again,
I noticed that when i changed the them ftom nitobe to pixture-reloaded the warninngs were gone!!!
Comment #21
Anonymous (not verified) CreditAttribution: Anonymous commented@dman: Do you have nitobe installed?
Comment #22
Anonymous (not verified) CreditAttribution: Anonymous commentedHmm... A theme is causing the issue? The only code I find in nitobe HEAD concerning taxonomy is
It calls taxonomy_link which calls taxonomy_preview_terms when $node->build_mode == NODE_BUILD_PREVIEW. So the next question is where is the error? Damien what do you have to say about this?
Comment #23
atiras CreditAttribution: atiras commentedI have wabi installed and active. No nitobe.
Comment #24
Anonymous (not verified) CreditAttribution: Anonymous commentedThe only mention of taxonomy in the wabi theme is a print of the $terms variable. It doesn't call the taxonomy_link or taxonomy_preview_terms function.
@atiras: What modules do you have enabled?
Comment #25
atiras CreditAttribution: atiras commentedFull list of modules below. As I said above, this only started appearing after I upgraded first to Views 6.x-2.1 and then Drupal 6.6. It may be relevant that after the upgrade to Drupal 6.6, some of my taxonomy vocabularies (Image Galleries and Web Links) lost their association with any node types. Since I manually re-instated these, I haven't seen the error reported again (yet).
Image 6.x-1.0-alpha3
Image assist 6.x-2.x-dev
Image Gallery 6.x-1.0-alpha3
Image Import 6.x-1.0-alpha3
insertFrame 6.x-1.2
Pathologic 6.x-1.1-beta13
GMap 6.x-1.0-rc2
GMap Macro Builder 6.x-1.0-rc2
GMap Taxonomy Markers 6.x-1.0-rc2
Advanced help 6.x-1.1
Menu breadcrumb 6.x-1.1
Nodeaccess 6.x-1.2
Pathauto 6.x-2.x-dev
Site Documentation 6.x-1.2
Term Display 6.x-1.0
Token 6.x-1.11
Token actions 6.x-1.11
Web Links 6.x-1.0
Web Links Filter 6.x-1.0
Views 6.x-2.1
Views exporter 6.x-2.1
Views UI 6.x-2.1
Comment #26
Anonymous (not verified) CreditAttribution: Anonymous commentedBTW, taxonomy_link is used in nitobe as described at http://api.drupal.org/api/function/taxonomy_link/6. The patch needs rolled with the changes I suggested at #5.
Comment #27
dman CreditAttribution: dman commentedNo nitobe for me. the only bits I didn't trust - the only bits on a fresh installation - were a full installation of ubercart. I couldn't see any justification for them messing with taxonomy, but OTOH, I couldn't speak for them either.
Comment #28
Militopedia CreditAttribution: Militopedia commentedHello,
Has this issue been resolved in the meantime? I also get the same warning message when I want to preview a comment or a node. I am using D6.6.
A stupid question: how can I use the patch? Do I have to copy/paste the content into the taxonomy module file?
Cheers,
Roger
Comment #29
Damien Tournoud CreditAttribution: Damien Tournoud commentedSo it's the theme that calls taxonomy_link() the second time. Interesting :)
Ok, let's keep that issue in D6 only for now, the taxonomy module is being heavily refactored in D7.
As a stop-gap solution for D6, I suggest we simply add a $node->built_preview_terms flag at the bottom of taxonomy_preview_terms() and check for it in the enclosing
if (isset($node->taxonomy))
of that function.Comment #30
Militopedia CreditAttribution: Militopedia commentedHi Damien,
Wow, that was fast! :-) Would you mind to tell me step by step what I have to do? I am a new Drupal user and don't know where to put the code you provided.
Although I assume I have to add it to the taxonomy.module file? Am I right? Does it matter where I put it (I mean in the beginning or end of the file?).
Cheers,
Roger
Comment #31
Militopedia CreditAttribution: Militopedia commentedHello,
Anybody willing to help? Any assistance is highly appreciated!
Cheers,
Roger
Comment #32
rup3rt CreditAttribution: rup3rt commentedSubscribing
Comment #33
smh67 CreditAttribution: smh67 commentedIf I understand Damien correctly, he suggests the attached patch. (Right? Damien, I hope you don't mind me jumping in. Thanks for suggesting a way to fix this!)
For those not familiar with patching files, you can manually replace lines 572-597 (all of the function taxonomy_preview_terms) in the Drupal 6.8 taxonomy.module with the below lines. Hope this helps.
Comment #34
Militopedia CreditAttribution: Militopedia commentedHi smh67,
It worked perfectly! THANKS a lot!! A big issue that prevented me from going online is now resolved.
Cheers,
Roger
Comment #35
catchNeeds review.
Comment #36
ebuck CreditAttribution: ebuck commentedHi there,
I'm using Drupal 6.9 and just came across this bug. Considering that it seems to be mostly harmless, it sure is ugly.
Here are the errors on preview after choosing a tag in the add/edit story page (not choosing a tag means no errors):
* warning: Illegal offset type in isset or empty in /html/modules/taxonomy/taxonomy.module on line 1015.
* warning: Illegal offset type in /html/modules/taxonomy/taxonomy.module on line 1016.
* warning: Illegal offset type in /html/modules/taxonomy/taxonomy.module on line 1019.
* warning: Illegal offset type in /html/modules/taxonomy/taxonomy.module on line 592.
* warning: Illegal offset type in isset or empty in /html/modules/taxonomy/taxonomy.module on line 1015.
* warning: Illegal offset type in /html/modules/taxonomy/taxonomy.module on line 1016.
* warning: Illegal offset type in /html/modules/taxonomy/taxonomy.module on line 1019.
* warning: Illegal offset type in /html/modules/taxonomy/taxonomy.module on line 592.
My installation only has core modules installed (no contributed modules) and I am indeed using the nitobe theme. I haven't checked against other themes but given that nitobe seems to be a common thread in this bug report, I suspect it's specific to nitobe.
Comment #37
Anonymous (not verified) CreditAttribution: Anonymous commentedI'm able to reproduce this on 6.10. I added an output line to
nitobe_render_terms
, selected a single taxonomy term and then clicked preview. I get this as the contents$node->taxonomy
.This is what I see walking through
taxonomy_preview_terms
At this point
$key
will be5
and$term
is an instance ofstdclass
.$term
is not an array so we drop through to the else below.taxonomy_get_term
expects a term ID - an int or something that can be turned into an int. It's being passed an object instead.Comment #38
skizzo CreditAttribution: skizzo commentedI am seeing it on Drupal 6.10, previewing a user profile.
I am using Garland (and content_profile for profile nodes).
Comment #39
Anonymous (not verified) CreditAttribution: Anonymous commented@shannon: You should have reviewed the thread. This was discussed at #4. See Damien's comment at #29.
Comment #40
Anonymous (not verified) CreditAttribution: Anonymous commentedThe issue was cross posted against Nitobe, and I started debugging before reading this thread. Besides, getting my hands dirty and learning how things work in core is never a bad thing. :-p
I'll patch the next release of Nitobe to accommodate this problem and add inline docs about why it's there.
Comment #41
charlesclayton CreditAttribution: charlesclayton commentedI am also receiving this issue on D 6.10 for any preview that included taxonomy terms. From what I understand this is a significant issue in relation to the display of content, especially to the unsuspecting user who is attempting to harmlessly add content and then may think they've done something wrong... or worse, that the website is dysfunctional. I'm somewhat surprised that an error related to taxonomy module would linger so long, but I'm keeping my eyes out for solutions and just reporting that I am receiving the same error on the most current version of Drupal. if anyone discovers a solution please post..
Comment #42
dman CreditAttribution: dman commentedTo be fair, the error, as far as we know, is not a problem with taxonomy module.
It's a problems with the way some other modules are interacting with core taxonomy. We are not sure how or why, but some contrib things expect $node->taxonomy to be turned into an array of ids not an array of objects (or something like that) at a certain point in the process.
However taxonomy.module breaks because it didn't expect that to happen. Therefore it's inconceivable. There is opposition to adding any proper error checking because it's something that should never happen.
Yet it does.
As a coder, I think that adding error handling and assertions where there is an identified need is sometimes necessary. The condition should not happen, but it did, so lets deal with it, and try to warn about the root cause when we can. "error handling"
Others just want the thing that causes the problem to stop doing so. Which is also a great way forward. But so far has failed.
We are often unable to replicate the issue, so haven't even boiled it down to one common module. Maybe there are several modules making the same mistake.
To get towards a solution, please post the contrib modules and theme you are using. And describe the taxonomy (select, freetag, required) etc
Maybe we will see a cause.
Comment #43
charlesclayton CreditAttribution: charlesclayton commentedI am using Taxonomy Manager & Taxonomy Menu, but something I noticed is that before I upgraded to Drupal 6.10 (from 6.4) this error was not occurring, or at least it wasn't being displayed during preview..
Nothing changed about my contrib modules, the Drupal version changed, and this occured.. I understand its how the contrib modules are interacting with taxonomy- not taxonomy itself, but I wonder what has changed with core taxonomy to create this 'error'.
Any help would be greatly appreciated, as I am looking for a solution for this.. Its not a site-breaking problem, but its certainly a problem that can scare users and make them less confident about your site.. I hope this is dealt with soon.
Thank you.
Comment #44
malc_b CreditAttribution: malc_b commentedI have 6.10 and I'm seeing the same issues which I track down to taxonomy_preview_terms then found this. I have cck, veiws, cck taxomony widget, token. Everything that needs taxomony that I don't use is turn off, some uninstalled too. I tried the patch above but that doesn't work for me. I've looked in page and node tpl files and no reference to taxomony. Changing theme to bluemarine has no effect so I don't think it is theme related. I do use cck to select the taxomony and some are multiple select. The problem is the same as above in that it is the line:
// A 'Single select' field returns the term id.
elseif ($term) {
//$taxonomy[$term] = taxonomy_get_term($term);
}
that gives the error. Comment that out and all is well. The $node->built_preview_terms does not seem to stay set. It starts off as {} then is set to {1} but next time round it is {} again
(I've stuck print "{";print_r($node->built_preview_terms);print "}"; at the start and end of the function).
UPDATE
The problem I think is line 578 "if (is_array($term))" $term is an object so fails this test and falls through to line 590
// A 'Single select' field returns the term id.
elseif ($term) {
$taxonomy[$term] = taxonomy_get_term($term);
}
"elseif ($term)" returns true as $term is not null, it's an object. Hence the next line throws a fit. I've patched 578 to be:
if (is_array($term) || is_object($term)) {
so it processes both now and this seems to fix the error.
Comment #45
ddwornik CreditAttribution: ddwornik commentedmalc_b,
Your fix does indeed hide the errors, unfortunately I get erroneous behaviour.
If I make changes to an items taxonomy, then hit preview, my changes are reset.
------------Added After More Testing-------------
For me it appears to be the module "Node Form Rearrange" that is triggering the error. When I disable it things work properly.
Additionally, in the preview page with errors, any re-arranging I have done is ignored, and the category fields are displayed under the title where they default.
When adding the is_object as suggested above, the errors are no longer displayed, but this movement of fields to their default location does happen.
Drupal 6.10, Node Form Rearrange 6.x-1.0
Comment #46
malc_b CreditAttribution: malc_b commentedI'm not using module "Node Form Rearrange" so that can't be my error.
Comment #47
mattgilbert CreditAttribution: mattgilbert commentedI tried this patch in 6.10 version, but it didn't get rid of the warnings. Is there a similar patch for taxonomy 6.10?
(edit: by "this patch" i mean the one from comment #33. )
Here are my installed modules:
Colorpicker
Colorpicker Widget
Content
Content Copy
Filefield
Filefield Meta
Imagefield
Option Widgets
Text
ImageAPI
ImageAPI GD2
Imagecache
Imagecache UI
getID3
Global Redirect
MetaTags
Pathauto
PNGFix
Taxonomy Breadcrumb
Taxonomy Defaults
Thickbox
Token
JQuery Update
Dynamic Rendering
Wysiwyg
Views
Views UI
Comment #48
smutek CreditAttribution: smutek commentedIt looks like Nitobe was causing the issues for me.
Below is the body of a post I made in the post installation forum last night.
After reading this thread I disabled Nitobe theme and this solved the issue for me. No more errors when previewing posts.
I still have the site running on a local mamp server, with the taxonomy errors, if I can be of any help please let me know. I know nothing about coding, but am willing to help out how I can.
** original post from post install forum **
________________________________
Moved my local drupal site to remote server today. Everything was running fine - until I decided to turn on forums.
Now, anytime I try to preview a new story, or any content type with a taxonomy field I get the following error:
The content will still post and the taxonomy will update (I have a taxonomy list appearing in a side bar menu to categorize stories) - but this error message is driving me completely insane.
In addition to the vocabulary automatically created by enabling forums, I am only using 1 taxonomy vocabulary with a total of about 20 terms.
I am new to drupal and am teaching myself, but I have tested this site extensively before uploading. As I mentioned everything was running fine, on both the remote site as well as the local site on my computer, until I enabled the forums module.
Also, to test this I enabled forums on the local machine and am getting the same problem.
This is why I really believe that whatever broke started when I turned on forums.
But who knows.
Further more, on the remote site I disabled forums and deleted the automatically created taxonomy list but "forum topic" still shows up as a content type in my create content menu. It does not show up when I go to admin/content types.
I am running drupal 6.1.2 along with the following contributed modules:
calendar, captcha, cck, date, fckeditor, imce, poor mans cron, taxonomy menu, views, getid3, audio and token
All modules are up to date....
Any help with this would be greatly appreciated. I've worked so hard to get this thing up and I have no idea how to fix this, other than wiping the slate clean and building the site again from the ground up. (not as bad as it sounds, and if it comes down to it that is what I will do - - - but I would like to avoid it if at all possible)
:(
Comment #49
aidanlis CreditAttribution: aidanlis commentedPatch http://drupal.org/node/275352#comment-1165929 did NOT solve the issue for me.
This patch does solve the issue,
http://drupal.org/files/issues/taxonomy-preview_terms_object_error-20081...
Modules:
Content 6.x-2.2
Content Taxonomy 6.x-1.0-beta6
Content Taxonomy Options 6.x-1.0-beta6
Views 6.x-2.5
Views UI 6.x-2.5
Taxonomy 6.10
Comment #50
aidanlis CreditAttribution: aidanlis commentedI've attached a patch which fixes the issue. When previewing, it checks if the term is already an object. If it is, we can safely assume it has already been converted and we'll bypass taxonomy_get_term().
Comment #51
aidanlis CreditAttribution: aidanlis commentedHere's a patch against HEAD
Comment #52
aidanlis CreditAttribution: aidanlis commentedHere's a patch against HEAD that should work with the test bot!
Comment #53
aidanlis CreditAttribution: aidanlis commentedThis bug seems to be related for those who have Content Taxonomy installed, http://drupal.org/node/391906
Comment #54
krisvannest CreditAttribution: krisvannest commentedSame error, using Nitobe and disabling it (or switching to another theme) works.
Unfortunately, I really like and need to use Nitobe-- I'm not familiar with patching core, like taxonomy, but heard it's not good to patch core if we can help it?
As a temp work-around, is there a way to disable previewing of new content? I found preview settings at admin/content/node-settings but didn't see an option for disabling previews altogether. I did apply the replacement code Shannon put up here (thx!), but unfortunately it broke my site/block formatting so I can't really use it.
thx KV
Comment #55
krisvannest CreditAttribution: krisvannest commentedAlthough I was concerned about patching core (not being that experienced), this 2nd patch above did solve it for me as well when using the Nitobe theme. thx KV
Comment #56
Dries CreditAttribution: Dries commentedThat patch is a bit of a hack. It sounds more logical to fix the caller. If we insist on proceeding with this patch (which I don't encourage we do), we should update the documentation to reflex this change.
Comment #57
aidanlis CreditAttribution: aidanlis commentedA quick grep through my drupal's source code shows that both taxonomy_link and taxonomy_preview_terms are not called in any external modules, so identifying the caller is harder than it seems.
To get this bug fixed properly, we need to be able to replicate it. Everyone that has an interest in getting this bug fixed (Nitobe users excepted, as you already have your fix) should try and replicate this with a fresh install of Drupal in the minimum number of steps possible.
Post your findings, anyone who can replicate the bug (in any number of steps) gets massive karma!
Comment #58
dman CreditAttribution: dman commentedI spent hours trying to track it - but wherever it happened was behind way to many magically-named, nested and layered hook callbacks for me to trace. I did not have Nitobe.
As I said above, I don't think it's unreasonable for a robust API to do a few assertions to to validate that the input it's been given won't cause pain just because it got a zero instead of a number > 1.
I know that all input from third-party modules is assumed to be perfect all the time in Drupal ... but as we can see ... mysterious things can go wrong. And as much as I'd also eliminate the cause this time - I'm also in favour of something that will stop it happening again.
If I had the chance I'd sprinkle a few more judicious assertions in other places too, specifically to trigger a warning - not death - when FAPI gets a value where it assumed an array would be. But that's dreaming, I know.
Comment #59
Anonymous (not verified) CreditAttribution: Anonymous commented@dman is right on with claiming that assertions need to be made by an API such as Drupal that help the user of the API to be correct. If we want the user (module developer in this case) to always supply the correct value then we must give the user the traceback information to find his error by throwing an exception with a message.
Comment #60
ck9 CreditAttribution: ck9 commentedAlso having this problem. When I create a node then select 'preview' it throws out: -
* warning: Illegal offset type in isset or empty in /home/mainwebpr1/public_html/proto/modules/taxonomy/taxonomy.module on line 1015.
* warning: Illegal offset type in /home/mainwebpr1/public_html/proto/modules/taxonomy/taxonomy.module on line 1016.
* warning: Illegal offset type in /home/mainwebpr1/public_html/proto/modules/taxonomy/taxonomy.module on line 1019.
* warning: Illegal offset type in /home/mainwebpr1/public_html/proto/modules/taxonomy/taxonomy.module on line 592.
* warning: Illegal offset type in isset or empty in /home/mainwebpr1/public_html/proto/modules/taxonomy/taxonomy.module on line 1015.
* warning: Illegal offset type in /home/mainwebpr1/public_html/proto/modules/taxonomy/taxonomy.module on line 1016.
* warning: Illegal offset type in /home/mainwebpr1/public_html/proto/modules/taxonomy/taxonomy.module on line 1019.
* warning: Illegal offset type in /home/mainwebpr1/public_html/proto/modules/taxonomy/taxonomy.module on line 592.
* warning: Illegal offset type in isset or empty in /home/mainwebpr1/public_html/proto/modules/taxonomy/taxonomy.module on line 1015.
* warning: Illegal offset type in /home/mainwebpr1/public_html/proto/modules/taxonomy/taxonomy.module on line 1016.
* warning: Illegal offset type in /home/mainwebpr1/public_html/proto/modules/taxonomy/taxonomy.module on line 1019.
* warning: Illegal offset type in /home/mainwebpr1/public_html/proto/modules/taxonomy/taxonomy.module on line 592.
* warning: Illegal offset type in isset or empty in /home/mainwebpr1/public_html/proto/modules/taxonomy/taxonomy.module on line 1015.
* warning: Illegal offset type in /home/mainwebpr1/public_html/proto/modules/taxonomy/taxonomy.module on line 1016.
* warning: Illegal offset type in /home/mainwebpr1/public_html/proto/modules/taxonomy/taxonomy.module on line 1019.
* warning: Illegal offset type in /home/mainwebpr1/public_html/proto/modules/taxonomy/taxonomy.module on line 592.
Comment #61
catchThis first needs steps to reproduce (other than with a buggy theme), then the patch should come with a test.
Comment #62
aidanlis CreditAttribution: aidanlis commentedI have reproduced this bug with a single module!
Taxonomy 6.12
Combined with the core modules:
Block 6.12
Filter 6.12
Node 6.12
System 6.12
User 6.12
I think what is happening is not an error in the code or module interaction, it is database ghosts that are being picked up and not handled properly by the Taxonomy module.
Comment #63
Anonymous (not verified) CreditAttribution: Anonymous commentedSubscribe.
This may not need to be an issue for Drupal 7. If we can put upon Field API all this madness of storing term values for nodes, previewing term values for nodes, etc., we can rely on its tests to prevent this. The goal is for this code to be gutted and discarded anyway. taxonomy_preview_terms should not be in Drupal 7. taxonomy_links may also have its days numbered, but I won't guess.
Comment #64
a.a.egoroff CreditAttribution: a.a.egoroff commentedThere was error: warnings: «Illegal offset type...»
This have been solved by this patch: http://drupal.org/files/issues/taxonomy-preview_terms_object_error-20081...
----------------------------
Tested on:
Drupal 6.13
CCK 2.4
Views 2.6
----------------------------
Subscribing…
Comment #65
Anonymous (not verified) CreditAttribution: Anonymous commentedThis is no longer a problem in Drupal 7 because of the Field API conversion of taxonomy.module.
I'm downgrading it to 6.x-dev, but I suspect someone might as well "won't fix" it.
Comment #66
TomSherlock CreditAttribution: TomSherlock commentedRegarding the patch, how do i apply it to my copy of Drupal?
Update: While i'm still not sure how to apply a patch, i took the code in the patch and made the relevant changes myself in the module. The error message is now gone.
Comment #67
skizzo CreditAttribution: skizzo commentedyou may want to check the Applying patches page
Comment #68
dman CreditAttribution: dman commented:) @TomSherlock #66
Going off topic a bit but..
Patching it by hand a few times is a great learning experience, and will give you more confidence about learning the tools that automate the process.
I think it's great that anyone should learn what a patch is, what it looks like and what it does - in real terms - before learning the tools and commands that you can use to use them. I think that will overcome a heap of the resistance or learning curve for many coders.
Comment #69
mikejonesok CreditAttribution: mikejonesok commentedThanks for the fix.
Comment #70
longwaveSome users are running into this on a complex site with several taxonomy related modules installed, and I'm having trouble reproducing it. The following errors are triggered when new forum nodes are being previewed by a small number of users under as yet unknown circumstances:
I realise that this is probably caused by one of the taxonomy related modules, but tracking down exactly which one seems impossible if I can't actually reproduce it myself.