diff --git a/core/lib/Drupal/Component/Utility/SortArray.php b/core/lib/Drupal/Component/Utility/SortArray.php index 61279f2205..38144b3a4e 100644 --- a/core/lib/Drupal/Component/Utility/SortArray.php +++ b/core/lib/Drupal/Component/Utility/SortArray.php @@ -128,8 +128,7 @@ public static function sortByKeyInt($a, $b, $key) { /** * Sorts a keyed array by weight and keys. * - * The list of enabled modules is expected to be ordered by weight and name. - * The list is always sorted on write to avoid the overhead on read. + * Array values are supposed to be casted to integer as weights for keys. * * @param array $array * A keyed array of names with weight as value. diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php index 9d8d7c73d1..3cc476ff18 100644 --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -195,6 +195,9 @@ public function install(array $module_list, $enable_dependencies = TRUE) { // improvement for module installation. $extension_config ->set("module.$module", 0) + // The list of enabled modules is expected to be ordered by weight and + // name. The list is always sorted on write to avoid the overhead on + // read. ->set('module', SortArray::sortByWeightAndKeys($extension_config->get('module'))) ->save(TRUE);