From 3e24cef2561a29a01205c6c0dd9e426f2e652648 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Wed, 1 Sep 2010 11:18:07 +0200 Subject: [PATCH] [HttpFoundation] fixed Request::hasSession() --- src/Symfony/Component/HttpFoundation/Request.php | 2 +- .../HttpFoundation/SessionStorage/NativeSessionStorage.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php index bb2541989c..55a8f2fd1a 100755 --- a/src/Symfony/Component/HttpFoundation/Request.php +++ b/src/Symfony/Component/HttpFoundation/Request.php @@ -254,7 +254,7 @@ class Request public function hasSession() { - return '' !== session_id(); + return $this->cookies->has(session_name()); } public function setSession(Session $session) diff --git a/src/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php index f013dcba87..32dec0fc93 100644 --- a/src/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php @@ -52,6 +52,8 @@ class NativeSessionStorage implements SessionStorageInterface 'session_cookie_httponly' => isset($cookieDefaults['httponly']) ? $cookieDefaults['httponly'] : false, 'session_cache_limiter' => 'none', ), $options); + + session_name($this->options['session_name']); } /** @@ -70,7 +72,6 @@ class NativeSessionStorage implements SessionStorageInterface $this->options['session_cookie_secure'], $this->options['session_cookie_httponly'] ); - session_name($this->options['session_name']); if (null !== $this->options['session_cache_limiter']) { session_cache_limiter($this->options['session_cache_limiter']);