Quellcode durchsuchen

Fixes fatal error when intl module is not installed.

drm vor 14 Jahren
Ursprung
Commit
9714cfc4f9
1 geänderte Dateien mit 6 neuen und 2 gelöschten Zeilen
  1. 6 2
      src/Symfony/Component/HttpFoundation/Session.php

+ 6 - 2
src/Symfony/Component/HttpFoundation/Session.php

@@ -355,10 +355,14 @@ class Session implements \Serializable
 
     private function setPhpDefaultLocale($locale)
     {
+        // if either the class Locale doesn't exist, or an exception is thrown when
+        // setting the default locale, the intl module is not installed, and
+        // the call can be ignored:
         try {
-            \Locale::setDefault($this->locale);
+            if (class_exists('Locale', false)) {
+                \Locale::setDefault($locale);
+            }
         } catch (\Exception $e) {
-            // means that intl is not installed.
         }
     }
 }