Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.415.2.7 diff -u -p -r1.415.2.7 theme.inc --- includes/theme.inc 25 Jun 2008 07:56:31 -0000 1.415.2.7 +++ includes/theme.inc 1 Jul 2008 20:57:21 -0000 @@ -596,7 +596,27 @@ function theme() { } if (isset($info['function'])) { // The theme call is a function. - $output = call_user_func_array($info['function'], $args); + + if (!empty($info['arguments'])) { + $count = 0; + foreach ($info['arguments'] as $name => $default) { + $variables[$name] = isset($args[$count]) ? $args[$count] : $default; + $count++; + } + } + + if (isset($info['preprocess functions']) && is_array($info['preprocess functions'])) { + // This construct ensures that we can keep a reference through + // call_user_func_array. + $preprocess_args = array(&$variables, $hook); + foreach ($info['preprocess functions'] as $preprocess_function) { + if (function_exists($preprocess_function)) { + call_user_func_array($preprocess_function, $preprocess_args); + } + } + } + + $output = call_user_func_array($info['function'], $variables); } else { // The theme call is a template.