Hey,

After enabling the devel_themer module, I get the above mentioned error the minute I try to navigate away from the administration pages.
i.e. go to the site homepage or any other non-admin page.

Any ideas what is up?

zend optimizer is disabled.

Comments

ardarvin’s picture

Hmmm....I think the error may be related to the theme itself. I'm using a newly submitted one: Artists C01 which generates the above error.
When I switch to Garland, the devel_themer module works fine.

Perhaps the theme is busted?

moshe weitzman’s picture

Status: Active » Closed (fixed)

yeah, themer does not use classes. please flle against the theme.

ztyx’s picture

Version: 6.x-1.x-dev » 6.x-1.8
Status: Closed (fixed) » Needs work
StatusFileSize
new1.07 KB

A follow up: It wasn't a question of class usage but instead only a faulty definition of theme_feed_icon(...) that, in devel_themer.module:devel_themer_theme_twin(), resulted in count($args) being bigger than count($params) which in turns led to trying to access a part of $params that was out of limit. See http://drupal.org/node/238231 for more info and patch.

This is an easy error that could happen during theming. I'm slightly new to Drupal so I don't know how to do error checking the best way, but how about solving this issue slightly more permanently by applying something similar to the attached patch? The error message will help a lot for people working on themes (including me)...

Also, devel_themer_theme_twin() is according to its documentation a modified copy of theme(). Maybe similar patch needs to be applied there.

moshe weitzman’s picture

Status: Needs work » Closed (works as designed)

Sending more arguments than expected is a feature of PHP that is commonly used

thomas23@drupal.org’s picture

Erm, sorry, but what do I read out of this? I'm getting the same error with a self developed theme which is a subtheme of zen.

Did I do something wrong in my subtheme? If not is this a bug of zen?

Cheers.

cha0s’s picture

Priority: Normal » Critical
StatusFileSize
new981 bytes

I just got this error when updating to Drupal 6. I don't see this as 'by design'. It is a bug that results in a fatal PHP error, and should be caught/echoed to the error console area. A patch follows, although one was written before me, but mine doesn't die(), it just echoes an error message and terminates the '$arg = $param' loop.

I shamelessly stole the text from the other patch since I didn't word it nearly as well (thinking like a coder, not a user...)

Again, we all appreciate PHP's ability to have variable number of args passed to a function, but in this specific case (because it results in a fatal PHP error) it must be caught, and an error message thrown.

[EDIT] I would be just as happy with changing the for loop to

for ($i=0; $i < min(count($args), count($params)); $i++) {

but I figured that actively warning the user would be better, since I haven't studied the code enough to know exactly why it's happening the way it is.

cha0s’s picture

Status: Closed (works as designed) » Active

Sorry for the double post, I just wanted to change the status so it hopefully won't get missed. Thanks for your attention.

moshe weitzman’s picture

Status: Active » Closed (works as designed)

We do not babysit broken code.

cha0s’s picture

Why does PHP even throw exceptions? It'd be much better for it to throw a GPF and take down the whole system.

Echoing errors is for losers...

danylevskyi’s picture

I have the same problem.
I noticed, that this error is thrown when I am trying to view pages with views2.

sidharth_k’s picture

I am getting this problem too. Please help

kenorb’s picture

I have the same problem when I'm going to activity (page of activity module).

Fatal error: Call to a member function getName() on a non-object in /devel/devel_themer.module on line 380
akahn’s picture

I'm also having this issue with a subtheme of Zen. Not asking you to deal with anyone else's code, Moshe, but do you think you could try to explain what you think the issue is here, so that people who are experiencing it can fix it? Something that doesn't make sense to me is why I get this error only on the front page of my site, not on node views or admin pages.

sidharth_k’s picture

I agree with akahn. Given that zen is an important, mainstream theme that so many people are using...would request some help on this... many thanks!

akahn’s picture

Well, I was able to squash my bug. This isn't part of Zen out of the box. I was using template_preprocess_user_picture in my subtheme's template.php. In that function, I was incorrectly using theme('imagecache',…), and that was causing the error.

gpk’s picture

Version: 6.x-1.8 » 6.x-1.12
Status: Closed (works as designed) » Active

Also having this problem with Acquia Marina theme. Anyone know how to find the root cause?

Ta muchly ... :)

gpk’s picture

Status: Fixed » Active

Actually the problem turns out to be in calendar_ical module, part of the Calendar package.

Many thanks to ztyx and cha0s for their suggestions. Here are more details instructions for finding out were the problem occurs, for those who aren't into patching or debuggers:

1. Make a backup copy of devel_themer.module
2. We need to Insert some debug code. The error occurs in the 2nd line below (the one with getName):

      for ($i=0; $i < count($args); $i++) {
        $meta['variables'][$params[$i]->getName()] = $args[$i];
      ...

Insert the following inside the for loop, immediately before the line beginning $meta['... :

        // Check for a bad theme call (see http://drupal.org/node/237056).
        if ($i == count($params)) {
          // Find the offending theme call
          $debug = debug_backtrace();
          drupal_set_message(count($args) . " arguments were passed to theme('$hook', ..) but it was only expecting " . count ($params) . ". Please debug the code that invoked theme('$hook', ..). Further debug info follows.<pre>" . print_r($debug[4], TRUE) . print_r($meta, TRUE) . print_r($info, TRUE) . '</pre>', 'error');
          break;
        }

3. Now view the problem page again. You should get all sorts of useful info about the problem (probably more than is strictly needed).

The significance of $debug[4] is that this seems to report the file and line with the bad theme call :-D :-D :-D. This should enable you to pinpoint the source of the problem quickly.

Would be great if somehow this type of problem could be caught automatically, in the way that Drupal's error handler catches other problems, making it easier for bugs to be identified, and hence reported and fixed. For people (e.g. theme developers) with even less PHP than I have the pain factor when this happens would pretty high (it was bad enough for me!). Especially as it might be nothing to do with the theme in question ..! And particularly if the problem is in a block (as in my case) - can take the whole site down.

gpk’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Active » Closed (fixed)

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

momo18’s picture

Category: support » bug
Status: Closed (fixed) » Active

Hi,

I am using Drupal 6.x, views 2 and the frontpage view, as well as panels 2, to promote a node to the front page, and I intend to use front-page.tpl.php in order to theme it differently. I am also using the devel module, the zen theme, and the zen classic sub-theme where I put the front-page.tpl.php in the subtheme folder. I'm getting the following error when I visit the front page of my test site.

The error I'm receiving is described below, and I really don't have PHP knowledge or the time to debug it fully. Anyway, here are the details. It seems to be a panels issue/problem. I know it isn't a devel problem per se, but in the devel module the problem occurred and it's somehow related. Can someone explain to me how to file or resolve this apparent panels problem. Since I've created everything on a fresh install of a test site, I know it isn't improper use of a theme or a view or something. The problem description follows below.

I want to use a sub-theme, and apparently it doesn't like a sub-theme. Unfortunately, if I cannot correct this error I might have to give up using the sub-theme feature in drupal 6. Can anyone help?

Thanks!
Moses

Technical Writing Services
www.itwrite.com

================================================================================================

Fatal error: Call to a member function getName() on a non-object in C:\xampp\htdocs\sites\all\modules\devel\devel_themer.module on line 386

================================================

I used the following debug code (mentioned above) and inserted it where recommended. The code is:

// Check for a bad theme call (see http://drupal.org/node/237056).
if ($i == count($params)) {
// Find the offending theme call
$debug = debug_backtrace();
drupal_set_message(count($args) . " arguments were passed to theme('$hook', ..) but it was only expecting " . count ($params) . ". Please debug the code that invoked theme('$hook', ..). Further debug info follows.

" . print_r($debug[4], TRUE) . print_r($meta, TRUE) . print_r($info, TRUE) . '

', 'error');
break;
}

================================================

I received the following output.

5 arguments were passed to theme('panels_default_style_render_panel', ..) but it was only expecting 4. Please debug the code that invoked theme('panels_default_style_render_panel', ..). Further debug info follows.

Array
(
[file] => C:\xampp\htdocs\sites\all\modules\panels\includes\display-render.inc
[line] => 303
[function] => theme
[args] => Array
(
[0] => panels_default_style_render_panel
[1] => panels_display Object
(
[args] => Array
(
)

[content] => Array
(
[1] => stdClass Object
(
[pid] => 1
[did] => 1
[panel] => middle
[type] => views
[subtype] => frontpage-page_1
[shown] => 1
[access] => Array
(
)

[visibility] =>
[configuration] => Array
(
[style] => rounded_corners
[override_title] => 0
[override_title_text] =>
[css_id] =>
[css_class] =>
[link_to_view] => 0
[more_link] => 0
[feed_icons] => 0
[use_pager] => 0
[pager_id] =>
[nodes_per_page] => 10
[offset] => 0
[panel_args] => 0
[args] =>
[url] =>
)

[cache] => Array
(
)

[position] => 0
[context] =>
)

)

[panels] => Array
(
[middle] => Array
(
[0] => 1
)

)

[incoming_content] =>
[css_id] =>
[context] => Array
(
)

[layout_settings] => Array
(
)

[panel_settings] => Array
(
)

[cache] => Array
(
)

[title] =>
[hide_title] => 0
[did] => 1
[layout] => onecol
[keywords] => Array
(
)

[owner] => stdClass Object
(
[pid] => 1
[name] => frontpage
[did] => 1
[title] => Groups Frontpage
[access] => Array
(
)

[path] => frontpage
[load_flags] => 0
[css_id] =>
[css] =>
[arguments] => Array
(
)

[displays] => Array
(
)

[contexts] => Array
(
)

[relationships] => Array
(
)

[no_blocks] => 0
[switcher_options] => Array
(
)

[switcher_name] =>
[switcher_type] =>
[menu] => 0
[menu_tab] =>
[menu_tab_weight] =>
[menu_title] =>
[menu_tab_default] =>
[menu_tab_default_parent_type] =>
[menu_parent_title] =>
[menu_parent_tab_weight] =>
[type] => Local
[context] => Array
(
)

[primary] => panels_display Object
*RECURSION*
[display] => panels_display Object
*RECURSION*
[current] => primary
[form] =>
[keywords] => Array
(
)

[id] => frontpage
)

[type] => panel_page
)

[2] => frontpage
[3] => Array
(
[1] => stdClass Object
(
[module] => views
[delta] => frontpagepage_1
[subject] => Front Page Moses
[content] =>

* Edit
* Export
* Clone

front page moses
Submitted by admin on Mon, 11/17/2008 - 22:41

front body moses

[title] => Front Page Moses
)

)

[4] => Array
(
)

[5] => middle
)

)
Array
(
[wildcards] => Array
(
)

[hook] => panels_default_style_render_panel
[path] => sites/all/modules/panels
[type] => func
[used] => theme_panels_default_style_render_panel
)
Array
(
[arguments] => Array
(
[display] =>
[panel_id] =>
[panes] =>
[settings] =>
)

[type] => module
[theme path] => sites/all/modules/panels
[function] => devel_themer_catch_function
[theme paths] => Array
(
[0] => sites/all/modules/panels
)

[preprocess functions] => Array
(
[0] => template_preprocess
)

[devel_function_intercept] => theme_panels_default_style_render_panel
)

=======================================================

The file display-render.inc where the problem actually began contains the following offending function that generated the error:

return theme($style['render panel'], $display, $owner_id, $panes, $style_settings, $panel);

========================================================

kenorb’s picture

So, what's the solution?

gpk’s picture

The solution would be to open an issue against the Panels project to let the developer know that the theme call on line 303 of display-render.inc uses incorrect arguments.

Bevan’s picture

Version: 6.x-1.12 » 6.x-1.x-dev
Priority: Critical » Normal
Status: Active » Closed (duplicate)

Patch at #340677: Fatal error: Call to getName() on non-object considers input from all commentors on this thread and solves the problem in a cleaner way.