Jelajahi Sumber

Fixes fatal error when intl module is not installed.

drm 14 tahun lalu
induk
melakukan
9714cfc4f9
1 mengubah file dengan 6 tambahan dan 2 penghapusan
  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.
         }
     }
 }