diff -u b/core/lib/Drupal/Core/Cache/DatabaseBackend.php b/core/lib/Drupal/Core/Cache/DatabaseBackend.php --- b/core/lib/Drupal/Core/Cache/DatabaseBackend.php +++ b/core/lib/Drupal/Core/Cache/DatabaseBackend.php @@ -444,7 +444,7 @@ /** * Defines the schema for the {cache_*} bin and {cachetags} tables. */ - public function getSchema($table_name = '') { + public function getSchema($table_name) { $schema[$this->bin] = array( 'description' => 'Storage for the cache API.', 'fields' => array( @@ -531,7 +531,7 @@ ), 'primary key' => array('tag'), ); - return isset($schema[$table_name]) ? $schema[$table_name] : NULL; + return isset($schema[$table_name]) ? $schema[$table_name] : FALSE; } } 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 @@ -118,7 +118,7 @@ /** * Defines the schema for the configuration table. */ - public function getSchema($table_name = '') { + public function getSchema($table_name) { $schema = array( 'description' => 'The base table for configuration data.', 'fields' => array( @@ -145,7 +145,7 @@ ), 'primary key' => array('collection', 'name'), ); - return $schema; + return $this->table == $table_name ? $schema : FALSE; } /** diff -u b/core/lib/Drupal/Core/Database/SchemaProviderInterface.php b/core/lib/Drupal/Core/Database/SchemaProviderInterface.php --- b/core/lib/Drupal/Core/Database/SchemaProviderInterface.php +++ b/core/lib/Drupal/Core/Database/SchemaProviderInterface.php @@ -20,14 +20,14 @@ * * @param string $table_name - * The name of the table being created. Typically it's safe to ignore this - * unless the class implementing this interface works with multiple tables. + * The name of the table being created. The implementation must check this. * - * @return array - * A schema API array + * @return array|FALSE + * A schema API array or FALSE if this implementation doesn't know about + * the $table_name table. * * @see hook_schema() * @see \Drupal\Core\Cache\DatabaseBackend */ - public function getSchema($table_name = ''); + public function getSchema($table_name); } diff -u b/core/lib/Drupal/Core/Menu/MenuTreeStorage.php b/core/lib/Drupal/Core/Menu/MenuTreeStorage.php --- b/core/lib/Drupal/Core/Menu/MenuTreeStorage.php +++ b/core/lib/Drupal/Core/Menu/MenuTreeStorage.php @@ -309,7 +309,7 @@ protected function preSave(array &$link, array $original) { static $schema_fields, $schema_defaults; if (empty($schema_fields)) { - $schema = $this->getSchema(); + $schema = $this->getSchema($this->table); $schema_fields = $schema['fields']; foreach ($schema_fields as $name => $spec) { if (isset($spec['default'])) { @@ -1110,7 +1110,7 @@ */ protected function serializedFields() { if (empty($this->serializedFields)) { - $schema = $this->getSchema(); + $schema = $this->getSchema($this->table); foreach ($schema['fields'] as $name => $field) { if (!empty($field['serialize'])) { $this->serializedFields[] = $name; @@ -1136,7 +1136,7 @@ * @return array * The schema API definition for the SQL storage table. */ - public function getSchema($table_name = '') { + public function getSchema($table_name) { $schema = array( 'description' => 'Contains the menu tree hierarchy.', 'fields' => array( @@ -1383,7 +1383,7 @@ ), ); - return $schema; + return $this->table == $table_name ? $schema: FALSE; } } diff -u b/core/modules/system/src/Tests/Database/SelectTest.php b/core/modules/system/src/Tests/Database/SelectTest.php --- b/core/modules/system/src/Tests/Database/SelectTest.php +++ b/core/modules/system/src/Tests/Database/SelectTest.php @@ -524,6 +524,6 @@ * @return array */ - public function getSchema($table_name = '') { - return drupal_get_schema_unprocessed('database_test', 'test'); + public function getSchema($table_name) { + return $table_name == 'test' ? drupal_get_schema_unprocessed('database_test', 'test') : FALSE; } }