diff -u b/core/includes/module.inc b/core/includes/module.inc --- b/core/includes/module.inc +++ b/core/includes/module.inc @@ -45,48 +45,47 @@ * * Acts as a wrapper around system_list(), returning either a list of all * enabled modules, or just modules needed for bootstrap. + * * An optional parameter allows an alternative module list to be provided, * which is then stored and used in subsequent calls instead of the one * provided by system_list(). * - * @param $type + * @param string $type * The type of list to return: * - module_enabled: All enabled modules. * - bootstrap: All enabled modules required for bootstrap. - * @param $fixed_list - * (optional) If an array of module names is provided, this will override the - * module list with the given set of modules. This will persist until the next - * call with a new $fixed_list passed in. This parameter is primarily - * intended for internal use (e.g., in install.php and update.php). + * @param array $fixed_list + * (optional) An array of module names to override the list of modules. This + * list will persist until the next call with a new $fixed_list passed in. + * Primarily intended for internal use (e.g., in install.php and update.php). * * @return * An associative array whose keys and values are the names of the modules in * the list. */ -function module_list($type = 'module_enabled', $fixed_list = NULL) { +function module_list($type = 'module_enabled', array $fixed_list = NULL) { // Tracks data acquired from $fixed_list. $module_list = &drupal_static(__FUNCTION__); // The list that will be be returned. Separate from $module_list in order - // to avoid statically caching data acquired from system_list(), since - // that function already has its own static cache. + // to not duplicate the static cache of system_list(). $list = $module_list; if (isset($fixed_list)) { foreach ($fixed_list as $name => $module) { drupal_get_filename('module', $name, $module['filename']); $module_list[$name] = $name; - } + } $list = $module_list; } elseif (!isset($module_list)) { - if ($type == 'bootstrap') { - $list = system_list('bootstrap'); - } - else { - // Not using drupal_map_assoc() here as that requires common.inc. - $list = array_keys(system_list($type)); - $list = (!empty($list) ? array_combine($list, $list) : array()); + if ($type == 'bootstrap') { + $list = system_list('bootstrap'); + } + else { + // Not using drupal_map_assoc() here as that requires common.inc. + $list = array_keys(system_list($type)); + $list = (!empty($list) ? array_combine($list, $list) : array()); } } return $list; @@ -212,6 +211,7 @@ */ function system_list_reset() { drupal_static_reset('system_list'); + drupal_static_reset('module_list'); drupal_static_reset('system_rebuild_module_data'); drupal_static_reset('list_themes'); cache('bootstrap')->deleteMultiple(array('bootstrap_modules', 'system_list')); @@ -660,8 +660,7 @@ $implementations['#write_cache'] = TRUE; $hook_info = module_hook_info(); $implementations[$hook] = array(); - $list = module_list(); - foreach ($list as $module) { + foreach (module_list() as $module) { $include_file = isset($hook_info[$hook]['group']) && module_load_include('inc', $module, $module . '.' . $hook_info[$hook]['group']); // Since module_hook() may needlessly try to load the include file again, // function_exists() is used directly here. diff -u b/core/includes/schema.inc b/core/includes/schema.inc --- b/core/includes/schema.inc +++ b/core/includes/schema.inc @@ -74,6 +74,7 @@ // that it contains the complete list of modules before we go on to call // module_load_all_includes(). drupal_static_reset('system_list'); + drupal_static_reset('module_list'); module_load_all_includes('install'); } diff -u b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php --- b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/WebTestBase.php @@ -776,6 +776,7 @@ // Reload module list and implementations to ensure that test module hooks // aren't called after tests. + drupal_static_reset('system_list'); drupal_static_reset('module_list'); module_implements_reset(); diff -u b/core/modules/system/lib/Drupal/system/Tests/Module/ClassLoaderTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/ClassLoaderTest.php --- b/core/modules/system/lib/Drupal/system/Tests/Module/ClassLoaderTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Module/ClassLoaderTest.php @@ -13,8 +13,6 @@ * Tests class loading. */ class ClassLoaderTest extends WebTestBase { - protected $profile = 'testing'; - public static function getInfo() { return array( 'name' => 'Module class loader', diff -u b/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc --- b/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -1198,7 +1198,6 @@ // Gets module list after install process, flushes caches and displays a // message if there are changes. - drupal_static_reset('system_list'); $post_install_list = module_list(); if ($pre_install_list != $post_install_list) { drupal_flush_all_caches(); diff -u b/core/modules/system/system.install b/core/modules/system/system.install --- b/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -514,6 +514,7 @@ // Clear out module list and hook implementation statics before calling // system_rebuild_theme_data(). drupal_static_reset('system_list'); + drupal_static_reset('module_list'); module_implements_reset(); // Load system theme data appropriately. diff -u b/core/modules/system/system.test b/core/modules/system/system.test --- b/core/modules/system/system.test +++ b/core/modules/system/system.test @@ -148,6 +148,7 @@ */ function assertModules(array $modules, $enabled) { drupal_static_reset('system_list'); + drupal_static_reset('module_list'); foreach ($modules as $module) { if ($enabled) { $message = 'Module "@module" is enabled.'; @@ -1674,6 +1675,7 @@ $this->drupalPost('admin/modules', $edit, t('Save configuration')); $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.')); drupal_static_reset('system_list'); + drupal_static_reset('module_list'); $this->assertFalse(module_exists('block'), t('Block module disabled.')); // At this point, no region is filled and fallback should be triggered. @@ -1708,6 +1710,7 @@ $this->drupalPost('admin/modules', $edit, t('Save configuration')); $this->assertText(t('The configuration options have been saved.'), t('Modules status has been updated.')); drupal_static_reset('system_list'); + drupal_static_reset('module_list'); $this->assertTrue(module_exists('block'), t('Block module re-enabled.')); } }