diff -u b/core/lib/Drupal/Core/Config/DatabaseStorage.php b/core/lib/Drupal/Core/Config/DatabaseStorage.php --- b/core/lib/Drupal/Core/Config/DatabaseStorage.php +++ b/core/lib/Drupal/Core/Config/DatabaseStorage.php @@ -68,7 +68,8 @@ */ public function exists($name) { try { - return (bool) $this->connection->queryRange('SELECT 1 FROM {' . $this->connection->escapeTable($this->table) . '} WHERE name = :name', 0, 1, array( + return (bool) $this->connection->queryRange('SELECT 1 FROM {' . $this->connection->escapeTable($this->table) . '} WHERE collection = :collection AND name = :name', 0, 1, array( + ':collection' => $this->collection, ':name' => $name, ), $this->options)->fetchField(); } diff -u b/core/modules/config/lib/Drupal/config/Tests/Storage/ConfigStorageTestBase.php b/core/modules/config/lib/Drupal/config/Tests/Storage/ConfigStorageTestBase.php --- b/core/modules/config/lib/Drupal/config/Tests/Storage/ConfigStorageTestBase.php +++ b/core/modules/config/lib/Drupal/config/Tests/Storage/ConfigStorageTestBase.php @@ -193,11 +193,13 @@ // Create configuration in a new collection. $new_storage = $this->storage->createCollection('collection.sub.new'); + $this->assertFalse($new_storage->exists($name)); $this->assertEqual(array(), $new_storage->listAll()); $new_storage->write($name, $data); $this->assertIdentical($result, TRUE); $this->assertIdentical($data, $new_storage->read($name)); $this->assertEqual(array($name), $new_storage->listAll()); + $this->assertTrue($new_storage->exists($name)); $new_data = array('foo' => 'baz'); $new_storage->write($name, $new_data); $this->assertIdentical($result, TRUE); @@ -205,11 +207,13 @@ // Create configuration in another collection. $another_storage = $this->storage->createCollection('collection.sub.another'); + $this->assertFalse($another_storage->exists($name)); $this->assertEqual(array(), $another_storage->listAll()); $another_storage->write($name, $new_data); $this->assertIdentical($result, TRUE); $this->assertIdentical($new_data, $another_storage->read($name)); $this->assertEqual(array($name), $another_storage->listAll()); + $this->assertTrue($another_storage->exists($name)); // Create configuration in yet another collection. $alt_storage = $this->storage->createCollection('alternate');