Illegal key offset warnings
fractile81 - April 8, 2008 - 22:43
| Project: | Synonym Collapsing |
| Version: | 6.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
When previewing a form that I've been working on (a form-altered node edit form), I kept getting numerous "Illegal key offset" warnings, both from this module and the taxonomy function taxonomy_get_term();. I dug into it, and it looks like it's coming from synonym_collapsing_preview_terms();. Now, I'm not sure if this is a problem with how I'm doing the form alter, or what, but changing line synonym_collapsing.module:155 to the following appears to have fixed my problem:
<?php
$tid = is_object($term) ? $term->tid : $term;
$taxonomy[$tid] = taxonomy_get_term($tid);
?>Basically, just taking into account that $term could also be an object, for whatever reason. I'm still trying to review my code, but I wanted to post this to see what others thought.

#1
This is definitely in your code. But it is also a good idea. :). Please attach this as a patch so it can be reviewed! :D
#2
I had the same problem -- took me weeks to find out it was due to this module, and all this time I thought I broke something an Drupal and was doomed to live with it.
This modification solves the problem. But, I blindly patched the module on my site without any reason as to why it works or if it is even the proper solution.
Thanks for filing the bug, fractile81. All this time, I thought the problem was unique to my instance.
#3
This is not a patch. Please post as a patch for my convenience. Thanks!