diff --git a/src/Symfony/Component/Translation/LocaleSwitcher.php b/src/Symfony/Component/Translation/LocaleSwitcher.php index c07809c58cbcc..4950a56bbb682 100644 --- a/src/Symfony/Component/Translation/LocaleSwitcher.php +++ b/src/Symfony/Component/Translation/LocaleSwitcher.php @@ -34,9 +34,14 @@ public function __construct( public function setLocale(string $locale): void { - if (class_exists(\Locale::class)) { - \Locale::setDefault($locale); + // Silently ignore if the intl extension is not loaded + try { + if (class_exists(\Locale::class, false)) { + \Locale::setDefault($locale); + } + } catch (\Exception) { } + $this->locale = $locale; $this->requestContext?->setParameter('_locale', $locale);
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: