Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 649c17e

Browse filesBrowse files
committed
[Validator] Fix the locale validator so it treats a locale alias as a valid locale
1 parent 6d5dbf7 commit 649c17e
Copy full SHA for 649c17e

File tree

Expand file treeCollapse file tree

2 files changed

+3
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-1
lines changed

‎src/Symfony/Component/Validator/Constraints/LocaleValidator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Constraints/LocaleValidator.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ public function validate($value, Constraint $constraint)
3838

3939
$value = (string) $value;
4040
$locales = Intl::getLocaleBundle()->getLocaleNames();
41+
$aliases = Intl::getLocaleBundle()->getAliases();
4142

42-
if (!isset($locales[$value])) {
43+
if (!isset($locales[$value]) && !array_search($value, $aliases)) {
4344
$this->context->addViolation($constraint->message, array(
4445
'{{ value }}' => $this->formatValue($value),
4546
));

‎src/Symfony/Component/Validator/Tests/Constraints/LocaleValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/LocaleValidatorTest.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function getValidLocales()
6161
array('pt'),
6262
array('pt_PT'),
6363
array('zh_Hans'),
64+
array('fil_PH'),
6465
);
6566
}
6667

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.