From c2b1029595afe103b5f1533604cfe658755f1f8d Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 6 Apr 2010 17:56:40 +0000 Subject: - Patch #592008 by moshe weitzman, David_Rothstein, chx: don't save theme registry before modules are included. --- includes/theme.inc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'includes') diff --git a/includes/theme.inc b/includes/theme.inc index b54f0bc13..2e5c691bd 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -764,6 +764,14 @@ function list_themes($refresh = FALSE) { */ function theme($hook, $variables = array()) { static $hooks = NULL; + + // If called before all modules are loaded, we do not necessarily have a full + // theme registry to work with, and therefore cannot process the theme + // request properly. See also _theme_load_registry(). + if (!module_load_all(NULL) && !defined('MAINTENANCE_MODE')) { + throw new Exception(t('theme() may not be called until all modules are loaded.')); + } + if (!isset($hooks)) { drupal_theme_initialize(); $hooks = theme_get_registry(); -- cgit v1.2.3