Browse Source

Fix gc as per interface definition and expectation/documentation.

dereuromark 8 years ago
parent
commit
6e289073d0
2 changed files with 3 additions and 3 deletions
  1. 1 1
      src/Network/Session/CacheSession.php
  2. 2 2
      src/Network/Session/DatabaseSession.php

+ 1 - 1
src/Network/Session/CacheSession.php

@@ -123,7 +123,7 @@ class CacheSession implements SessionHandlerInterface
     /**
      * Helper function called on gc for cache sessions.
      *
-     * @param string $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed.
+     * @param int $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed.
      * @return bool Always true.
      */
     public function gc($maxlifetime)

+ 2 - 2
src/Network/Session/DatabaseSession.php

@@ -170,12 +170,12 @@ class DatabaseSession implements SessionHandlerInterface
     /**
      * Helper function called on gc for database sessions.
      *
-     * @param string $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed.
+     * @param int $maxlifetime Sessions that have not updated for the last maxlifetime seconds will be removed.
      * @return bool True on success, false on failure.
      */
     public function gc($maxlifetime)
     {
-        $this->_table->deleteAll(['expires <' => time()]);
+        $this->_table->deleteAll(['expires <' => time() - $maxlifetime]);
 
         return true;
     }