diff --git a/core/lib/Drupal/Core/Config/Config.php b/core/lib/Drupal/Core/Config/Config.php index 7c150e9121a..034dff18fd9 100644 --- a/core/lib/Drupal/Core/Config/Config.php +++ b/core/lib/Drupal/Core/Config/Config.php @@ -346,7 +346,6 @@ class Config { * The configuration object. */ public function save() { - $this->sortByKey($this->data); $this->storage->write($this->name, $this->data); $this->isNew = FALSE; $this->notify('save'); @@ -369,26 +368,6 @@ class Config { return $this; } - /** - * Sorts all keys in configuration data. - * - * Ensures that re-inserted keys appear in the same location as before, in - * order to ensure an identical order regardless of storage controller. - * A consistent order is important for any storage that allows any kind of - * diff operation. - * - * @param array $data - * An associative array to sort recursively by key name. - */ - public function sortByKey(array &$data) { - ksort($data); - foreach ($data as &$value) { - if (is_array($value)) { - $this->sortByKey($value); - } - } - } - /** * Deletes the configuration object. * diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php index 9eea495957d..c755b4a46fe 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigCRUDTest.php @@ -92,30 +92,4 @@ class ConfigCRUDTest extends WebTestBase { $this->assertIdentical($renamed_config->isNew(), FALSE); } - /** - * Tests Drupal\Core\Config\Config::sortByKey(). - */ - function testDataKeySort() { - $config = config('config_test.keysort'); - $config->set('new', 'Value to be replaced'); - $config->set('static', 'static'); - $config->save(); - // Clone this Config, so this test does not rely on any particular - // architecture. - $config = clone $config; - - // Load the configuration data into a new object. - $new_config = config('config_test.keysort'); - // Clear the 'new' key that came first. - $new_config->clear('new'); - // Add a new 'new' key and save. - $new_config->set('new', 'Value to be replaced'); - $new_config->save(); - - // Verify that the data of both objects is in the identical order. - // assertIdentical() is the required essence of this test; it performs a - // strict comparison, which means that keys and values must be identical and - // their order must be identical. - $this->assertIdentical($new_config->get(), $config->get()); - } } diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php index 9316962398d..2266732157c 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php @@ -128,10 +128,10 @@ class ConfigImportTest extends WebTestBase { $staging->write($name, $original_name_data); $original_dynamic_data = array( 'id' => 'new', - 'label' => 'New', - 'langcode' => 'und', - 'style' => '', 'uuid' => '30df59bd-7b03-4cf7-bb35-d42fc49f0651', + 'label' => 'New', + 'style' => '', + 'langcode' => 'und', ); $staging->write($dynamic_name, $original_dynamic_data); $this->assertIdentical($staging->exists($name), TRUE, $name . ' found.');