I have a page manager page at 'taxonomy/term/%term/admin'. This page pulls over a VBO view and nothing else. I get an error when visiting this page from the taxonomy.module file.
warning: Illegal offset type in isset or empty in /var/www/modules/taxonomy/taxonomy.module on line 1090, 1091 and 1094.
I've narrowed this down to the data that is being passed into the first parameter in taxonomy_get_term($tid, $reset = FALSE). Somehow this function is being passed a ctools_context object for the $tid parameter. Here is the object below. I used my good friend print_r() to find the data.
This is how print_r() prints out objects.
ctools_context Object
(
[type] => term
[data] => stdClass Object
(
[tid] => 24
[vid] => 1
[name] => Coca-Cola "STUFF"
[description] => lots of misc. collectibles...one of a kind items!
[weight] => 0
)
[title] => Coca-Cola "STUFF"
[page_title] =>
[identifier] => Taxonomy term: ID
[argument] => 24
[keyword] => term
[original_argument] => 24
[restrictions] => Array
(
)
[empty] =>
[plugin] => term
[description] => lots of misc. collectibles...one of a kind items!
[id] => argument_term_1
)
Here is the object.
<?php
$tid->type = 'term';
$tid->data = new stdClass();
$tid->data->tid = 24;
$tid->data->vid = 1;
$tid->data->name = 'Coca-Cola "STUFF"';
$tid->data->description = 'lots of misc. collectibles...one of a kind items!';
$tid->data->weight = 0;
$tid->title = 'Coca-Cola "STUFF"';
$tid->page_title = '';
$tid->identifier = 'Taxonomy term: ID';
$tid->argument = 24;
$tid->keyword = 'term';
$tid->original_argument = 24;
$tid->restrictions = array();
$tid->empty = '';
$tid->plugin = 'term';
$tid->description = 'lots of misc. collectibles...one of a kind items!';
$tid->id = 'argument_term_1';
?>
I'm not sure what function is responsible for passing in this object as the $tid... Hopefully someone with some more experience can lend a hand. Thanks for the help in advance
Comments
Comment #1
merlinofchaos commentedPerhaps a debug_backtrace() in taxonomy_get_term would help, to see where that's being called from.
Comment #2
Steven Brown commentedThank you merlin :) Didn't know that function existed.
So I've never used this function before and it's output is an array. However, I'm not sure when reading the output but I don't see the object described above which concerns me... Maybe I'm just not reading correctly.
If anyone reads through this ummm karma++ :) Thanks for the help.
Comment #3
merlinofchaos commentedWill that trace looks fine to me. I think, though, that maybe what you need to do is put it in an if() and check that the argument taxonomy_get_term() gets is actually wrong before doing the backtrace.
Comment #4
Steven Brown commentedBingo... :) Found the file. Not sure what to do with it though.
Comment #5
Steven Brown commentedJust looked closer... not sure how the page_title module would be messing up things or sending over a ctools_context object.
Comment #6
Steven Brown commentedSo it is the page_title module... and not sure how it would be causing this. Also, I believe I should move this to the page_title module. However, Merlin I will let you determine that just in case there's something I'm over looking.
Comment #7
merlinofchaos commentedIt's causing this because Page Manager is getting a context object from the menu loader, but page title is expecting a taxonomy tid and not verifying that. Since the path is not taxonomy/term/% page title is probably confused that the % isn't conforming to what taxonomy/term/% has. It's a fundamental difference between how page manager works and how Drupal works natively because page manager is very dependent upon context.
Comment #8
Steven Brown commentedI just reviewed the code that calls taxonomy_get_term(). What is being passed to the $tid is $menu_item['map'][2]. The map 2 just happens to be the ctools_context object.
So my question is, should there be a patch or is this just an issue because this is how Drupal vs Page Manager works and I need to live with it?
Comment #9
Steven Brown commentedCross referencing issues #1811526: Illegal offset type in isset or empty taxonomy.module lines 1090, 1091, 1094.
I have proposed a simple solution on the page_title's issue queue. Not sure what to change the status to but to me this is closed(Works as designed).
Thanks for all the help Merlin