diff --git a/core/includes/config.inc b/core/includes/config.inc index c143dd4..d2e169a 100644 --- a/core/includes/config.inc +++ b/core/includes/config.inc @@ -1,6 +1,7 @@ delete($name); } @@ -180,6 +187,8 @@ function config_import() { * @param Drupal\Core\Config\StorageInterface $target_storage * The storage to synchronize configuration to. * + * @throws Drupal\Core\Config\ConfigException + * * @todo Add support for other extension types; e.g., themes etc. */ function config_import_invoke_owner(array $config_changes, StorageInterface $source_storage, StorageInterface $target_storage) { @@ -191,6 +200,10 @@ function config_import_invoke_owner(array $config_changes, StorageInterface $sou // handle dependencies correctly. foreach (array('delete', 'create', 'change') as $op) { foreach ($config_changes[$op] as $key => $name) { + // Bail out if the configuration object is not namespaced by extension. + if (strpos($name, '.') === FALSE) { + throw new ConfigException(sprintf('Missing namespace in Config name %s', $name)); + } // Extract owner from configuration object name. $module = strtok($name, '.'); // Check whether the module implements hook_config_import() and ask it to diff --git a/core/lib/Drupal/Core/Config/Config.php b/core/lib/Drupal/Core/Config/Config.php index ffddd61..054c4bf 100644 --- a/core/lib/Drupal/Core/Config/Config.php +++ b/core/lib/Drupal/Core/Config/Config.php @@ -238,8 +238,15 @@ class Config { /** * Saves the configuration object. + * + * @throws Drupal\Core\Config\ConfigException */ public function save() { + // All configuration objects need to be namespaced by extension, as it would + // be impossible to maintain them otherwise. + if (strpos($this->name, '.') === FALSE) { + throw new ConfigException(sprintf('Missing namespace in Config name %s', $this->name)); + } $this->sortByKey($this->data); $this->storageDispatcher->selectStorage('write', $this->name)->write($this->name, $this->data); $this->isNew = FALSE;