diff -u b/core/lib/Drupal/Core/Config/Config.php b/core/lib/Drupal/Core/Config/Config.php --- b/core/lib/Drupal/Core/Config/Config.php +++ b/core/lib/Drupal/Core/Config/Config.php @@ -311,7 +311,7 @@ * Saves the configuration object. */ public function save() { - if ($this->sorted) { + if (!$this->sorted) { $this->sortByKey($this->data); } $this->storage->write($this->name, $this->data); @@ -364,14 +364,13 @@ * @param array $data * An associative array to sort recursively by key name. */ - public function sortByKey(array $data) { + public function sortByKey(array &$data) { ksort($data); foreach ($data as &$value) { if (is_array($value)) { $value = $this->sortByKey($value); } } - return $data; } /** diff -u b/core/modules/block/block.module b/core/modules/block/block.module --- b/core/modules/block/block.module +++ b/core/modules/block/block.module @@ -958,11 +958,10 @@ * Implements hook_rebuild(). */ function block_rebuild() { - // Rehash blocks for active themes. We don't use list_themes() here, - // because if MAINTENANCE_MODE is defined it skips reading the database, - // and we can't tell which themes are active. - foreach (list_themes() as $name => $weight) { - _block_rehash($name); + foreach (list_themes() as $name => $data) { + if ($data->status) { + _block_rehash($name); + } } }