I enabled the latest chaos tools release on D7, and I get a a notice on every page load.

The reason is that if $info['function'] refers to a non-existing function name, then the $output variable won't be defined at all. I created a little patch which provides a fix to the problem.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tamasd’s picture

Version: 7.0-alpha5 » 7.x-dev

Oops, I set the wrong version.

Damien Tournoud’s picture

Not sure what to do with this. I'm not very fond of silently ignoring issues.

Nick Lewis’s picture

Priority: Critical » Normal

Doesn't seem critical. I little confused, if the theme function doesn't exist, wouldn't it cause a fatal error? My guess is that for one reason another the ctools function isn't returning output like its supposed to. Mind telling us what function its calling? Also, while setting $output = ''; will solve the notice, the a is whether perhaps its useful to have a notice display when a theme function is returning no output?

IF the answer is no then, clearly we'd want to initialize $output a little higher (line 863 theme.inc) too:

  $output = '';
  // Generate the output using either a function or a template.
  if (isset($info['function'])) {
tamasd’s picture

FileSize
541 bytes

The problem is that it causes a bit confusing error message.

Notice: Undefined variable: output in theme() (line 918 of /home/yorirou/public_html/7/includes/theme.inc).

Maybe it can be better if the theme function outputs a proper error message?

With this patch, the error message looks like this:

Debug: Theme function does not exist: ctools_theme_menu_local_tasks in theme() (line 873 of /home/yorirou/public_html/7/includes/theme.inc).

effulgentsia’s picture

Status: Active » Closed (duplicate)

Same basic thoughts are on #674108: ThemeManager::theme() does not trigger an error when a theme hook is not found, but there's still an open question on that issue as to what to do besides throw an error. Please help out on that one. Thanks!