From a550906ba0757ea66913f9bc164a280a6fa37d04 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Riikka=20Kalliom=C3=A4ki?= <riikka.kalliomaki@helsinki.fi>
Date: Thu, 14 Jan 2016 14:14:13 +0200
Subject: [PATCH] Return value from save callback

---
 module/VuFind/src/VuFind/Session/Database.php | 5 +++--
 module/VuFind/src/VuFind/Session/File.php     | 5 +++--
 module/VuFind/src/VuFind/Session/Memcache.php | 4 ++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/module/VuFind/src/VuFind/Session/Database.php b/module/VuFind/src/VuFind/Session/Database.php
index a7321047ba1..f2af30e7220 100644
--- a/module/VuFind/src/VuFind/Session/Database.php
+++ b/module/VuFind/src/VuFind/Session/Database.php
@@ -65,11 +65,12 @@ class Database extends AbstractBase
      * @param string $sess_id The current session ID
      * @param string $data    The session data to write
      *
-     * @return void
+     * @return bool
      */
     public function write($sess_id, $data)
     {
         $this->getTable('Session')->writeSession($sess_id, $data);
+        return true;
     }
 
     /**
@@ -101,4 +102,4 @@ class Database extends AbstractBase
     {
         $this->getTable('Session')->garbageCollect($sess_maxlifetime);
     }
-}
\ No newline at end of file
+}
diff --git a/module/VuFind/src/VuFind/Session/File.php b/module/VuFind/src/VuFind/Session/File.php
index 4d10d3b651a..be1690b0aa4 100644
--- a/module/VuFind/src/VuFind/Session/File.php
+++ b/module/VuFind/src/VuFind/Session/File.php
@@ -106,7 +106,7 @@ class File extends AbstractBase
      * @param string $sess_id The current session ID
      * @param string $data    The session data to write
      *
-     * @return void
+     * @return bool
      */
     public function write($sess_id, $data)
     {
@@ -115,7 +115,7 @@ class File extends AbstractBase
             $return = fwrite($fp, $data);
             fclose($fp);
             if ($return !== false) {
-                return;
+                return true;
             }
         }
         // If we got this far, something went wrong with the file output...
@@ -123,6 +123,7 @@ class File extends AbstractBase
         // outside of the context of exception handling, so all we can do is
         // echo a message.
         echo 'Cannot write session to ' . $sess_file . "\n";
+        return false;
     }
 
     /**
diff --git a/module/VuFind/src/VuFind/Session/Memcache.php b/module/VuFind/src/VuFind/Session/Memcache.php
index 8d69116374d..733fc7a86ed 100644
--- a/module/VuFind/src/VuFind/Session/Memcache.php
+++ b/module/VuFind/src/VuFind/Session/Memcache.php
@@ -95,7 +95,7 @@ class Memcache extends AbstractBase
      * @param string $sess_id The current session ID
      * @param string $data    The session data to write
      *
-     * @return void
+     * @return bool
      */
     public function write($sess_id, $data)
     {
@@ -120,4 +120,4 @@ class Memcache extends AbstractBase
         // Perform Memcache-specific cleanup:
         return $this->getConnection()->delete("vufind_sessions/{$sess_id}");
     }
-}
\ No newline at end of file
+}
-- 
GitLab