Do not use constant AUN_CASE_LEAVE_ASIS in auto_username.settings.yml

Created on 22 December 2023, about 1 year ago

Problem/Motivation

auto_username.settings contains the line: aun_case: AUN_CASE_LEAVE_ASIS. AUN_CASE_LEAVE_ASIS is a constant in PHP, but it will be seen as a string in YML files. This means that on install, neither value for the "Character case" radio buttons is chosen. It is supposed to default to the first item.

Steps to reproduce

View admin/config/people/accounts/patterns after install. Export config and see that aun_case is replaced with 0.

Proposed resolution

Use 0 instead of AUN_CASE_LEAVE_ASIS in auto_username.settings.

Remaining tasks

Implement.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Liam Morland
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦
  • 🇳🇿New Zealand jlscott

    @Liam Morland: is this still a problem now that 📌 Refactor legacy code and fix phpcs issues Active has been committed?

  • 🇨🇦Canada Liam Morland Ontario, CA 🇨🇦

    I am not familiar with the !php/const syntax, but it looks plausible. If it does what it appears to do, then it will fix this.

  • 🇧🇪Belgium adiatis Belgium

    I got this error on update drupal or install new module:

    Drupal\Core\Config\UnsupportedDataTypeConfigException: Invalid data type in config auto_username.settings, found in file modules/contrib/auto_username/config/install/auto_username.settings.yml: The string "!php/const Drupal\auto_username\AutoUsernamePunctuationOptions::CASE_LEAVE_AS_IS" could not be parsed as a constant.

    I installed lastest dev version but #3391633 didn't solved the problem.

    I changed

    aun_case: !php/const Drupal\auto_username\AutoUsernamePunctuationOptions::CASE_LEAVE_AS_IS

    to

    aun_case: 0

    error is gone.

  • Status changed to RTBC 6 months ago
  • 🇫🇷France jibus

    Got error when enabled the module :

    Drupal\Core\Config\UnsupportedDataTypeConfigException: Invalid data type in config auto_username.settings, found in file modules/contrib/auto_username/config/install/auto_username.settings.yml: The string "!php/const Drupal\auto_username\AutoUsernamePunctuationOptions::CASE_LEAVE_AS_IS" could not be parsed as a constant. Did you forget to pass the "Yaml::PARSE_CONSTANT" flag to the parser? at line 5 (near "aun_case: !php/const Drupal\auto_username\AutoUsernamePunctuationOptions::CASE_LEAVE_AS_IS") in Drupal\Core\Config\FileStorage->read() (line 118 of /var/www/lc.cx/web/core/lib/Drupal/Core/Config/FileStorage.php).

    Set aun_case: 0 in auto_username.settings.yml fixed the issue.

    Switch to major since this module cannot be installed.

  • 🇮🇹Italy kris77

    Set aun_case: 0 in auto_username.settings.yml fixed the issue for me too.

    Thanks @adiatis @Jibus

  • First commit to issue fork.
  • 🇷🇺Russia sorlov

    rebased branch from latest 8.x-1.x, so now MR can be merged

  • 🇨🇦Canada leducdubleuet Chicoutimi QC

    Cannot install the module without this patch on Drupal 10.3.6.

    Thank you.

Production build 0.71.5 2024