diff --git a/src/Symfony/Component/Validator/Constraints/LocaleValidator.php b/src/Symfony/Component/Validator/Constraints/LocaleValidator.php index bf73a560c443d..49783b6698e3d 100644 --- a/src/Symfony/Component/Validator/Constraints/LocaleValidator.php +++ b/src/Symfony/Component/Validator/Constraints/LocaleValidator.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\Intl\Intl; +use Symfony\Component\Intl\Locale as IntlLocale; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\Exception\UnexpectedTypeException; @@ -42,12 +43,12 @@ public function validate($value, Constraint $constraint) $value = (string) $value; if ($constraint->canonicalize) { - $value = \Locale::canonicalize($value); + $value = IntlLocale::canonicalize($value); } - $locales = Intl::getLocaleBundle()->getLocaleNames(); - $aliases = Intl::getLocaleBundle()->getAliases(); + $localeBundle = Intl::getLocaleBundle(); + $locales = $localeBundle->getLocaleNames(); - if (!isset($locales[$value]) && !in_array($value, $aliases)) { + if (!isset($locales[$value]) && !in_array($value, $localeBundle->getAliases(), true)) { $this->context->buildViolation($constraint->message) ->setParameter('{{ value }}', $this->formatValue($value)) ->setCode(Locale::NO_SUCH_LOCALE_ERROR)
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: