Jelajahi Sumber

merged branch drm/master (PR #1615)

Commits
-------

9714cfc Fixes fatal error when intl module is not installed.

Discussion
----------

Session instantiation breaks with Fatal error if intl module is not installed.

A check for class_exists in setPhpDefaultLocale() fixes this, though I got the feeling it should be resolved with a proxy or subscriber object; setPhpDefaultLocale feels like a hack now.

---------------------------------------------------------------------------

by stealth35 at 2011/07/10 06:32:43 -0700

Locale::setDefault don't throw any exception
Maybe just :

```php
if (class_exists('Locale', false)) {
    return \Locale::setDefault($this->locale);
} else {
    return false;
}
```
Fabien Potencier 14 tahun lalu
induk
melakukan
29460becde
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)
     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 {
         try {
-            \Locale::setDefault($this->locale);
+            if (class_exists('Locale', false)) {
+                \Locale::setDefault($locale);
+            }
         } catch (\Exception $e) {
         } catch (\Exception $e) {
-            // means that intl is not installed.
         }
         }
     }
     }
 }
 }