Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 299249

drush config:set for other than default collections raises exception

$
0
0

Problem/Motivation

Trying to set language specific config, for example Spanish site name:

$ drush -y config:set language.es:system.site name "Hola Mundo"

Raises the following exception:

Invalid character in Config object name language.es:system.site.

Whereas the following two commands just work fine:

$ drush config:get language.es:system.site name
'language.es:system.site:name': 'Hello World'
$ drush -y config:set system.site name "Hello World"
 // Do you want to update name key in system.site config?: yes.

Proposed resolution

in core/lib/Drupal/Core/Config/ConfigBase.php inside public static function validateName($name) the following

    // The name must not contain any of the following characters:
    // : ? * < > "' / \
    if (preg_match('/[:?*<>"\'\/\\\\]/', $name)) {
      throw new ConfigNameException("Invalid character in Config object name $name.");
    }

may better be

    // The name must not contain any of the following characters:
    // : ? * < > "' / \
    // Except for language-specific collections.
    if (!preg_match('/^language.[a-z]{2}:/', $name)) {
      if (preg_match('/[:?*<>"\'\/\\\\]/', $name)) {
        throw new ConfigNameException("Invalid character in Config object name $name.");
      }
    }

to exclude at least language-specific collections from invalid character check. Although I'm not sure if it's not even better to make that a more general solution, for example if there are other collections than language collections. But are or can be there any other collections except language collections?

Remaining tasks

* patch provided
* reviews needed
* tests to be run
* documentation to be written

User interface changes

- None -

API changes

Unsure about that.

Data model changes

- None -


Viewing all articles
Browse latest Browse all 299249

Latest Images

Trending Articles



Latest Images