Skip to content

[Validator] Fix the locale validator so it treats a locale alias as a valid locale #18049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 8, 2016

Conversation

jakzal
Copy link
Contributor

@jakzal jakzal commented Mar 7, 2016

Q A
Branch 2.3
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #12583
License MIT
Doc PR -

@@ -22,7 +22,7 @@
"require-dev": {
"doctrine/common": "~2.3",
"symfony/http-foundation": "~2.1",
"symfony/intl": "~2.3",
"symfony/intl": "^2.3.21",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LocaleBundle::getAliases() was introduced in Symfony 2.3.21. Without this tests with --prefer-lowest fail.


if (!isset($locales[$value])) {
if (!isset($locales[$value]) && !array_search($value, $aliases)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we are not interested in the index wouldn't it be make sense to use in_array() instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obviously :)

@jakzal jakzal force-pushed the validator-locale-alias branch from 3854889 to fbb12d8 Compare March 7, 2016 19:18
@xabbuh
Copy link
Member

xabbuh commented Mar 7, 2016

👍

Status: Reviewed

@webmozart
Copy link
Contributor

👍

@fabpot
Copy link
Member

fabpot commented Mar 8, 2016

Thank you @jakzal.

@fabpot fabpot merged commit fbb12d8 into symfony:2.3 Mar 8, 2016
fabpot added a commit that referenced this pull request Mar 8, 2016
… alias as a valid locale (jakzal)

This PR was merged into the 2.3 branch.

Discussion
----------

[Validator] Fix the locale validator so it treats a locale alias as a valid locale

| Q             | A
| ------------- | ---
| Branch        | 2.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12583
| License       | MIT
| Doc PR        | -

Commits
-------

fbb12d8 [Validator] Fix the locale validator so it treats a locale alias as a valid locale
@jakzal jakzal deleted the validator-locale-alias branch March 8, 2016 08:20
@fabpot fabpot mentioned this pull request Mar 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants