Browse Source

Fixes fatal error when intl module is not installed.

drm 14 years ago
parent
commit
9714cfc4f9
1 changed files with 6 additions and 2 deletions
  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.
         }
     }
 }