Skip to content

Commit

Permalink
Merge branch '2.3' into 2.7
Browse files Browse the repository at this point in the history
* 2.3:
  [Filesystem] Fix false positive in ->remove()
  [Validator] Fix the locale validator so it treats a locale alias as a valid locale

Conflicts:
	src/Symfony/Component/Filesystem/Tests/FilesystemTest.php
	src/Symfony/Component/Validator/Constraints/LocaleValidator.php
	src/Symfony/Component/Validator/composer.json
  • Loading branch information
nicolas-grekas committed Mar 8, 2016
2 parents 59e9b8f + cc862ed commit ee40cb4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Constraints/LocaleValidator.php
Expand Up @@ -43,8 +43,9 @@ public function validate($value, Constraint $constraint)

$value = (string) $value;
$locales = Intl::getLocaleBundle()->getLocaleNames();
$aliases = Intl::getLocaleBundle()->getAliases();

if (!isset($locales[$value])) {
if (!isset($locales[$value]) && !in_array($value, $aliases)) {
if ($this->context instanceof ExecutionContextInterface) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
Expand Down
1 change: 1 addition & 0 deletions Tests/Constraints/LocaleValidatorTest.php
Expand Up @@ -67,6 +67,7 @@ public function getValidLocales()
array('pt'),
array('pt_PT'),
array('zh_Hans'),
array('fil_PH'),
);
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -22,7 +22,7 @@
"require-dev": {
"doctrine/common": "~2.3",
"symfony/http-foundation": "~2.1",
"symfony/intl": "~2.4",
"symfony/intl": "~2.7.4",
"symfony/yaml": "~2.0,>=2.0.5",
"symfony/config": "~2.2",
"symfony/property-access": "~2.3",
Expand Down

0 comments on commit ee40cb4

Please sign in to comment.