Skip to content

LanguageValidator case sensitive #49615

@oleg-andreyev

Description

@oleg-andreyev

Symfony version(s) affected

6.1.4

Description

LanguageValidator is case-sensitive, while writing EN, en, DE, de are valid.

How to reproduce

  • create field that is validated by \Symfony\Component\Validator\Constraints\Language
  • validate object/model with this field, try: EN validation won't pass, try en everything will be okay.

\Symfony\Component\Intl\Languages::getAlpha3Codes is returning keys are lower-case.

Possible Solution

  • Add option ignore case and if it's TRUE, normalize case (to match \Symfony\Component\Intl\Languages::getAlpha3Codes)

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureGood first issueIdeal for your first contribution! (some Symfony experience may be required)Help wantedIssues and PRs which are looking for volunteers to complete them.StalledStatus: Needs ReviewValidator

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions