소스 검색

[HttpFoundation] fixed locale accessors in Session class

ornicar 14 년 전
부모
커밋
9588860716
1개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  1. 5 4
      src/Symfony/Component/HttpFoundation/Session.php

+ 5 - 4
src/Symfony/Component/HttpFoundation/Session.php

@@ -21,7 +21,6 @@ use Symfony\Component\HttpFoundation\SessionStorage\SessionStorageInterface;
 class Session implements \Serializable
 {
     protected $storage;
-    protected $locale;
     protected $attributes;
     protected $oldFlashes;
     protected $started;
@@ -171,7 +170,7 @@ class Session implements \Serializable
             $this->start();
         }
 
-        return $this->getAttribute('_locale');
+        return $this->attributes['_locale'];
     }
 
     /**
@@ -181,9 +180,11 @@ class Session implements \Serializable
      */
     public function setLocale($locale)
     {
-        if ($this->locale != $locale) {
-            $this->setAttribute('_locale', $locale);
+        if (false === $this->started) {
+            $this->start();
         }
+
+        $this->attributes['_locale'] = $locale;
     }
 
     public function getFlashMessages()