Skip to content

Commit ee40cb4

Browse files
Merge branch '2.3' into 2.7
* 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
2 parents 59e9b8f + cc862ed commit ee40cb4

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

Constraints/LocaleValidator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ public function validate($value, Constraint $constraint)
4343

4444
$value = (string) $value;
4545
$locales = Intl::getLocaleBundle()->getLocaleNames();
46+
$aliases = Intl::getLocaleBundle()->getAliases();
4647

47-
if (!isset($locales[$value])) {
48+
if (!isset($locales[$value]) && !in_array($value, $aliases)) {
4849
if ($this->context instanceof ExecutionContextInterface) {
4950
$this->context->buildViolation($constraint->message)
5051
->setParameter('{{ value }}', $this->formatValue($value))

Tests/Constraints/LocaleValidatorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public function getValidLocales()
6767
array('pt'),
6868
array('pt_PT'),
6969
array('zh_Hans'),
70+
array('fil_PH'),
7071
);
7172
}
7273

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"require-dev": {
2323
"doctrine/common": "~2.3",
2424
"symfony/http-foundation": "~2.1",
25-
"symfony/intl": "~2.4",
25+
"symfony/intl": "~2.7.4",
2626
"symfony/yaml": "~2.0,>=2.0.5",
2727
"symfony/config": "~2.2",
2828
"symfony/property-access": "~2.3",

0 commit comments

Comments
 (0)