diff -u b/core/lib/Drupal/Core/Render/theme.api.php b/core/lib/Drupal/Core/Render/theme.api.php --- b/core/lib/Drupal/Core/Render/theme.api.php +++ b/core/lib/Drupal/Core/Render/theme.api.php @@ -1190,16 +1190,18 @@ * request. When adding a template variable that depends on other context, it is * your responsibility to appropriately reset the static cache in * ThemeManager's getDefaultTemplateVariables() when needed: - * //TODO This would be an API change. Should we stick with 'template_preprocess'? + * @todo Change 'template_preprocess' key for Drupal 8.1 or 9 because + * template_preprocess() is removed. * @code - * drupal_static_reset('theme.manager.getDefaultTemplateVariables'); + * drupal_static_reset('template_preprocess'); * @endcode * * See user_template_preprocess_default_variables_alter() for an example. * * @param array $variables * An associative array of default template variables, as set up by - * _template_preprocess_default_variables(). Passed by reference. + * Drupal/Core/Theme/ThemeManagerInterface::getDefaultTemplateVariables(). + * Passed by reference. * @see Drupal/Core/Theme/ThemeManagerInterface::addDefaultTemplateVariables() * @see Drupal/Core/Theme/ThemeManagerInterface::getDefaultTemplateVariables() */ diff -u b/core/lib/Drupal/Core/Theme/Registry.php b/core/lib/Drupal/Core/Theme/Registry.php --- b/core/lib/Drupal/Core/Theme/Registry.php +++ b/core/lib/Drupal/Core/Theme/Registry.php @@ -603,7 +603,7 @@ // @see https://www.drupal.org/node/2457295 if (isset($cache[$previous_hook]) && !isset($cache[$previous_hook]['incomplete preprocess functions'])) { $cache[$hook] = $incomplete_previous_hook + $cache[$previous_hook]; - if (isset($incomplete_previous_hook['preprocess functions'])) { + if (!empty($incomplete_previous_hook['preprocess functions'])) { $diff = array_diff($incomplete_previous_hook['preprocess functions'], $cache[$previous_hook]['preprocess functions']); $cache[$hook]['preprocess functions'] = array_merge($cache[$previous_hook]['preprocess functions'], $diff); } diff -u b/core/lib/Drupal/Core/Theme/ThemeManager.php b/core/lib/Drupal/Core/Theme/ThemeManager.php --- b/core/lib/Drupal/Core/Theme/ThemeManager.php +++ b/core/lib/Drupal/Core/Theme/ThemeManager.php @@ -475,8 +475,10 @@ public function getDefaultTemplateVariables() { static $drupal_static_fast; if (!isset($drupal_static_fast)) { - //TODO Should we stick with 'template_preprocess' as the cacne key? - $drupal_static_fast['default_variables'] = &drupal_static($this->_serviceId.'.'.__FUNCTION__); + // @todo Change 'template_preprocess' key for Drupal 8.1 or 9 because + // template_preprocess() is removed. + // @see hook_template_preprocess_default_variables_alter() + $drupal_static_fast['default_variables'] = &drupal_static('template_preprocess'); } $default_variables = &$drupal_static_fast['default_variables']; if(!isset($default_variables)) { reverted: --- b/core/modules/user/user.module +++ a/core/modules/user/user.module @@ -534,7 +534,7 @@ function user_user_login($account) { // Reset static cache of default variables in template_preprocess() to reflect // the new user. + drupal_static_reset('template_preprocess'); - drupal_static_reset('theme.manager.getDefaultTemplateVariables'); } /** @@ -543,7 +543,7 @@ function user_user_logout($account) { // Reset static cache of default variables in template_preprocess() to reflect // the new user. + drupal_static_reset('template_preprocess'); - drupal_static_reset('theme.manager.getDefaultTemplateVariables'); } /**