diff --git a/core/lib/Drupal/Core/Config/Config.php b/core/lib/Drupal/Core/Config/Config.php index d354799..b1b329a 100644 --- a/core/lib/Drupal/Core/Config/Config.php +++ b/core/lib/Drupal/Core/Config/Config.php @@ -56,6 +56,11 @@ class Config extends StorableConfigBase { /** * Constructs a configuration object. * + * A valid name must : + * - Be namespaced by its owner (i.e. contain at least one '.'). + * - Be shorter than Config::MAX_LENGTH characters. + * - Not contain any of the following characters: ? : * < > " ' / \ + * * @param string $name * The name of the configuration object being constructed. * @param \Drupal\Core\Config\StorageInterface $storage @@ -67,6 +72,9 @@ class Config extends StorableConfigBase { * The typed configuration manager service. */ public function __construct($name, StorageInterface $storage, EventDispatcherInterface $event_dispatcher, TypedConfigManagerInterface $typed_config) { + + // Validate the configuration object name. + static::validateName($name); $this->name = $name; $this->storage = $storage; $this->eventDispatcher = $event_dispatcher; @@ -204,8 +212,6 @@ public function clear($key) { * {@inheritdoc} */ public function save() { - // Validate the configuration object name before saving. - static::validateName($this->name); // If there is a schema for this configuration object, cast all values to // conform to the schema.