Browse Source

Session::$name

walkor 3 years ago
parent
commit
547f463d9c
3 changed files with 9 additions and 23 deletions
  1. 0 21
      src/Protocols/Http.php
  2. 2 2
      src/Protocols/Http/Request.php
  3. 7 0
      src/Protocols/Http/Session.php

+ 0 - 21
src/Protocols/Http.php

@@ -32,13 +32,6 @@ class Http
     protected static $_requestClass = Request::class;
 
     /**
-     * Session name.
-     *
-     * @var string
-     */
-    protected static $_sessionName = 'PHPSID';
-
-    /**
      * Upload tmp dir.
      *
      * @var string
@@ -53,20 +46,6 @@ class Http
     protected static $_enableCache = true;
 
     /**
-     * Get or set session name.
-     *
-     * @param string|null $name
-     * @return string
-     */
-    public static function sessionName($name = null)
-    {
-        if ($name !== null && $name !== '') {
-            static::$_sessionName = (string)$name;
-        }
-        return static::$_sessionName;
-    }
-
-    /**
      * Get or set the request class name.
      *
      * @param string|null $class_name

+ 2 - 2
src/Protocols/Http/Request.php

@@ -299,7 +299,7 @@ class Request
             unset($this->sid);
         }
         if (!isset($this->sid)) {
-            $session_name = Http::sessionName();
+            $session_name = Session::$name;
             $sid = $session_id ? '' : $this->cookie($session_name);
             if ($sid === '' || $sid === null) {
                 if ($this->connection === null) {
@@ -331,7 +331,7 @@ class Request
         $session = new Session($new_sid);
         $session->put($session_data);
         $cookie_params = Session::getCookieParams();
-        $session_name = Http::sessionName();
+        $session_name = Session::$name;
         $this->setSidCookie($session_name, $new_sid, $cookie_params);
     }
 

+ 7 - 0
src/Protocols/Http/Session.php

@@ -38,6 +38,13 @@ class Session
     protected static $_handlerConfig = null;
 
     /**
+     * Session name.
+     *
+     * @var string
+     */
+    public static $name = 'PHPSID';
+
+    /**
      * Session lifetime.
      *
      * @var int