Skip to content

Magento 2 Store Code validation regex: doesn't support uppercase letters in scope code #25668

Closed
@attheCube

Description

@attheCube

Preconditions (*)

  1. Magento v2.3.3
  2. Magento 2.4-develop

Steps to reproduce (*)

  1. Setup stores/store-groups/websites with uppercase scope codes via setup script.
  2. Try to use to show configuration for this store via console.
    => bin/magento config:show --scope=store --scope-code=de_AT

Expected result (*)

  1. Output of store configuration

Actual result (*)

  1. Output of error message:
    "The scope code can include only lowercase letters (a-z), numbers (0-9) and underscores (_). Also, the first character must be a letter."

Similar report: #11996

This report resulted in adjustment of the error message because the former reporter had no good reason.

One good reason why it should be possible to use uppercase letters in store code, is to differentiate regions in store code. Especially for using storecodes within url.
So you could use at least 'de_DE', 'de_AT', 'en_US' or 'en_UK' as store codes, which is very useful in urls.

To be RFC 4646 (https://tools.ietf.org/html/rfc4646) conform, there has to be the possibility to use hyphens for store codes, too.

Surely it would be possible to do something weird by having this possibility, but that lies in the responsibility of the projects lead.

Additonal information:

See comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Component: StoreIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P3May be fixed according to the position in the backlog.Progress: doneReported on 2.3.3Indicates original Magento version for the Issue report.Reproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseSeverity: S3Affects non-critical data or functionality and does not force users to employ a workaround.stale issue

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions