From 9588860716c59a52c7816e9807d55b96ef02f92a Mon Sep 17 00:00:00 2001 From: ornicar Date: Sun, 29 Aug 2010 11:53:54 -0700 Subject: [PATCH] [HttpFoundation] fixed locale accessors in Session class --- src/Symfony/Component/HttpFoundation/Session.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Session.php b/src/Symfony/Component/HttpFoundation/Session.php index af317460a7..b91fc456ab 100644 --- a/src/Symfony/Component/HttpFoundation/Session.php +++ b/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()