From 27fff6654cde00a3fbab32252ecb776c2ba682d8 Mon Sep 17 00:00:00 2001
From: Ere Maijala <ere.maijala@helsinki.fi>
Date: Thu, 21 Apr 2016 15:08:45 -0400
Subject: [PATCH] Further session handling fixes for PHP 7.

---
 module/VuFind/src/VuFind/Session/AbstractBase.php | 12 +++++++-----
 module/VuFind/src/VuFind/Session/Database.php     |  7 +++++--
 module/VuFind/src/VuFind/Session/File.php         |  4 ++--
 module/VuFind/src/VuFind/Session/Memcache.php     |  2 +-
 4 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/module/VuFind/src/VuFind/Session/AbstractBase.php b/module/VuFind/src/VuFind/Session/AbstractBase.php
index 4ddfe1a2e06..63be861328d 100644
--- a/module/VuFind/src/VuFind/Session/AbstractBase.php
+++ b/module/VuFind/src/VuFind/Session/AbstractBase.php
@@ -81,7 +81,7 @@ abstract class AbstractBase implements SaveHandlerInterface,
      * @param string $sess_path Session save path
      * @param string $sess_name Session name
      *
-     * @return void
+     * @return bool
      *
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
@@ -94,7 +94,7 @@ abstract class AbstractBase implements SaveHandlerInterface,
      * Close function, this works like a destructor in classes and is executed
      * when the session operation is done.
      *
-     * @return void
+     * @return bool
      */
     public function close()
     {
@@ -111,12 +111,13 @@ abstract class AbstractBase implements SaveHandlerInterface,
      *
      * @param string $sess_id The session ID to destroy
      *
-     * @return void
+     * @return bool
      */
     public function destroy($sess_id)
     {
         $table = $this->getTable('Search');
         $table->destroySession($sess_id);
+        return true;
     }
 
     /**
@@ -125,7 +126,7 @@ abstract class AbstractBase implements SaveHandlerInterface,
      *
      * @param int $sess_maxlifetime Maximum session lifetime.
      *
-     * @return void
+     * @return bool
      *
      * @SuppressWarnings(PHPMD.UnusedFormalParameter)
      */
@@ -142,5 +143,6 @@ abstract class AbstractBase implements SaveHandlerInterface,
         // Anecdotal testing Today and Yesterday seems to indicate destroy()
         //   is called by the garbage collector and everything is good.
         // Something to keep in mind though.
+        return true;
     }
-}
\ No newline at end of file
+}
diff --git a/module/VuFind/src/VuFind/Session/Database.php b/module/VuFind/src/VuFind/Session/Database.php
index f2af30e7220..c75904be26c 100644
--- a/module/VuFind/src/VuFind/Session/Database.php
+++ b/module/VuFind/src/VuFind/Session/Database.php
@@ -79,7 +79,7 @@ class Database extends AbstractBase
      *
      * @param string $sess_id The session ID to destroy
      *
-     * @return void
+     * @return bool
      */
     public function destroy($sess_id)
     {
@@ -88,6 +88,8 @@ class Database extends AbstractBase
 
         // Now do database-specific destruction:
         $this->getTable('Session')->destroySession($sess_id);
+
+        return true;
     }
 
     /**
@@ -96,10 +98,11 @@ class Database extends AbstractBase
      *
      * @param int $sess_maxlifetime Maximum session lifetime.
      *
-     * @return void
+     * @return bool
      */
     public function gc($sess_maxlifetime)
     {
         $this->getTable('Session')->garbageCollect($sess_maxlifetime);
+        return true;
     }
 }
diff --git a/module/VuFind/src/VuFind/Session/File.php b/module/VuFind/src/VuFind/Session/File.php
index be1690b0aa4..b91331a2746 100644
--- a/module/VuFind/src/VuFind/Session/File.php
+++ b/module/VuFind/src/VuFind/Session/File.php
@@ -132,7 +132,7 @@ class File extends AbstractBase
      *
      * @param string $sess_id The session ID to destroy
      *
-     * @return void
+     * @return bool
      */
     public function destroy($sess_id)
     {
@@ -153,7 +153,7 @@ class File extends AbstractBase
      *
      * @param int $maxlifetime Maximum session lifetime.
      *
-     * @return void
+     * @return bool
      */
     public function gc($maxlifetime)
     {
diff --git a/module/VuFind/src/VuFind/Session/Memcache.php b/module/VuFind/src/VuFind/Session/Memcache.php
index 733fc7a86ed..c23af6ffdde 100644
--- a/module/VuFind/src/VuFind/Session/Memcache.php
+++ b/module/VuFind/src/VuFind/Session/Memcache.php
@@ -110,7 +110,7 @@ class Memcache extends AbstractBase
      *
      * @param string $sess_id The session ID to destroy
      *
-     * @return void
+     * @return bool
      */
     public function destroy($sess_id)
     {
-- 
GitLab