Skip to content

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

Closed
@zack6849

Description

@zack6849

Preconditions

  1. Magento v2.1.9 (Probably earlier versions as well)

Steps to reproduce

  1. Go to stores > all stores
  2. Create Store View
  3. Attempt to create a store code with uppercase letters

Expected result

  1. It should work, or give an error message

Actual result

  1. You get an error message back saying

The store code may contain only letters (a-z), numbers (0-9) or underscore (_), and the first character must be a letter.

Now, this error message is totally acceptable, makes perfect sense, but it let's say, for example, your store code you tried was ACME_STORE1, it's only letters and numbers, and has an underscore, and the first character is a letter, by all accounts, this should work, as far as i'm aware.

Unless there's a reason the store code is lowercase only the regex here:

$storeCodeRule = new \Zend_Validate_Regex('/^[a-z]+[a-z0-9_]*$/');

should either be changed to /^[A-z]+[A-z0-9_]*$/, or the message should be changed to indicate that only lowercase letters are supported.

Metadata

Metadata

Assignees

Labels

Fixed in 2.1.xThe issue has been fixed in 2.1 release lineFixed in 2.2.xThe issue has been fixed in 2.2 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions