Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.599 diff -u -p -r1.599 theme.inc --- includes/theme.inc 7 Jun 2010 06:38:09 -0000 1.599 +++ includes/theme.inc 7 Jun 2010 17:32:05 -0000 @@ -764,7 +764,7 @@ function theme($hook, $variables = array } } if (!isset($hooks[$hook])) { - watchdog('theme', 'Theme key "@key" not found.', array('@key' => $hook), WATCHDOG_WARNING); + trigger_error(t('Theme key %key not found.', array('%key' => $hook))); return ''; } } @@ -866,6 +866,13 @@ function theme($hook, $variables = array if (function_exists($info['function'])) { $output = $info['function']($variables); } + else { + // If a function implementation is registered but doesn't exist, it's + // either due to a bug in a module or theme, or module or theme code has + // been updated without the theme registry being rebuilt. + trigger_error(t('Theme function %function not found.', array('%function' => $info['function']))); + $output = ''; + } } else { // Default render function and extension. @@ -1214,10 +1221,14 @@ function theme_get_setting($setting_name * The output generated by the template. */ function theme_render_template($template_file, $variables) { - extract($variables, EXTR_SKIP); // Extract the variables to a local namespace - ob_start(); // Start output buffering - include DRUPAL_ROOT . '/' . $template_file; // Include the template file - return ob_get_clean(); // End buffering and return its contents + // Extract the variables to a local namespace, setup an output buffer, + // include the template file which will output its markup to the buffer, and + // return that markup. If the template file does not exist, the "include" + // statement will emit a PHP warning, which is desired. + extract($variables, EXTR_SKIP); + ob_start(); + include DRUPAL_ROOT . '/' . $template_file; + return ob_get_clean(); } /**