소스 검색

Call session_name() only if user gave an new one. Closes #1418

stloyd 14 년 전
부모
커밋
756ea8db39
1개의 변경된 파일12개의 추가작업 그리고 9개의 파일을 삭제
  1. 12 9
      src/Symfony/Component/HttpFoundation/SessionStorage/NativeSessionStorage.php

+ 12 - 9
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']);
+        }
     }
 
     /**