diff --git a/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php b/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php index b634941..8a8abcc 100644 --- a/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php +++ b/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php @@ -20,10 +20,14 @@ class ConfigCollectionInfo extends Event { * The maximum length of a collection name. * * The length of a collection name is limited by the maximum key length of - * ISAM tables which is 1000 bytes. Config names are 255 characters long. This - * leaves 235 bytes or 78 unicode characters for collection names. + * MyISAM tables which is 1000 bytes, or 333 unicode characters. + * Configuration object names are 250 characters long, so we cap collection + * collection names at 80 characters. + * + * @see \Drupal\Core\Config\ConfigBase::MAX_NAME_LENGTH + * @see \Drupal\Core\Config\DatabaseStorage::schemaDefinition() */ - const COLLECTION_MAX_LENGTH = 78; + const COLLECTION_MAX_LENGTH = 80; /** * Configuration collection information keyed by collection name. @@ -48,15 +52,15 @@ class ConfigCollectionInfo extends Event { * Exception thrown if $collection is equal to * \Drupal\Core\Config\StorageInterface::DEFAULT_COLLECTION * @throws \Drupal\Core\Config\ConfigCollectionException - * Exception thrown is $collection length exceeds - * self::COLLECTION_MAX_LENGTH. + * Exception thrown when $collection length exceeds + * ConfigCollectionInfo::COLLECTION_MAX_LENGTH. */ public function addCollection($collection, ConfigFactoryOverrideInterface $override_service = NULL) { if ($collection == StorageInterface::DEFAULT_COLLECTION) { throw new \InvalidArgumentException('Can not add the default collection to the ConfigCollectionInfo object'); } if (Unicode::strlen($collection) > static::COLLECTION_MAX_LENGTH) { - throw new ConfigCollectionException(String::format('The collection name !collection is too long, the maximum number of characters is !max_length', array('!collection' => $collection, '!max_length' => static::COLLECTION_MAX_LENGTH))); + throw new ConfigCollectionException(String::format('The collection name !collection is longer than !max_length.', array('!collection' => $collection, '!max_length' => static::COLLECTION_MAX_LENGTH))); } $this->collections[$collection] = $override_service; } diff --git a/core/lib/Drupal/Core/Config/DatabaseStorage.php b/core/lib/Drupal/Core/Config/DatabaseStorage.php index fff4a7a..a2672bb 100644 --- a/core/lib/Drupal/Core/Config/DatabaseStorage.php +++ b/core/lib/Drupal/Core/Config/DatabaseStorage.php @@ -191,14 +191,16 @@ protected static function schemaDefinition() { 'collection' => array( 'description' => 'Primary Key: Config object collection.', 'type' => 'varchar', - 'length' => 78, + // @see \Drupal\Core\Config\ConfigCollectionInfo::COLLECTION_MAX_LENGTH + 'length' => 80, 'not null' => TRUE, 'default' => '', ), 'name' => array( 'description' => 'Primary Key: Config object name.', 'type' => 'varchar', - 'length' => 255, + // @see \Drupal\Core\Config\ConfigBase::MAX_NAME_LENGTH + 'length' => 250, 'not null' => TRUE, 'default' => '', ),