From 756ea8db39421cdbec07b2a6fd457540b4cedb47 Mon Sep 17 00:00:00 2001 From: stloyd Date: Mon, 4 Jul 2011 14:46:04 +0200 Subject: [PATCH] Call session_name() only if user gave an new one. Closes #1418 --- .../SessionStorage/NativeSessionStorage.php | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php index 15a756a5ef..8ff04ca844 100644 --- a/src/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php +++ b/src/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php @@ -26,8 +26,8 @@ class NativeSessionStorage implements SessionStorageInterface /** * Available options: * - * * name: The cookie name (_SESS by default) - * * id: The session id (null by default) + * * name: The cookie name (null [ommited] by default) + * * id: The session id (null [ommited] by default) * * lifetime: Cookie lifetime * * path: Cookie path * * domain: Cookie domain @@ -43,15 +43,18 @@ class NativeSessionStorage implements SessionStorageInterface $cookieDefaults = session_get_cookie_params(); $this->options = array_merge(array( - 'name' => '_SESS', - 'lifetime' => $cookieDefaults['lifetime'], - 'path' => $cookieDefaults['path'], - 'domain' => $cookieDefaults['domain'], - 'secure' => $cookieDefaults['secure'], - 'httponly' => isset($cookieDefaults['httponly']) ? $cookieDefaults['httponly'] : false, + 'name' => null, + 'lifetime' => $cookieDefaults['lifetime'], + 'path' => $cookieDefaults['path'], + 'domain' => $cookieDefaults['domain'], + 'secure' => $cookieDefaults['secure'], + 'httponly' => isset($cookieDefaults['httponly']) ? $cookieDefaults['httponly'] : false, ), $options); - session_name($this->options['name']); + // Skip setting new session name if user don't wan't it + if (isset($this->options['name'])) { + session_name($this->options['name']); + } } /**