From 26342de93e320328b5b72a8feb9ba95809b9deb5 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 8 Oct 2009 16:23:15 -0600 Subject: [PATCH] The write/close should be done in the destructor --- framework/SessionHandler/lib/Horde/SessionHandler.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/framework/SessionHandler/lib/Horde/SessionHandler.php b/framework/SessionHandler/lib/Horde/SessionHandler.php index 54812dffe..b12cf559b 100644 --- a/framework/SessionHandler/lib/Horde/SessionHandler.php +++ b/framework/SessionHandler/lib/Horde/SessionHandler.php @@ -132,6 +132,17 @@ class Horde_SessionHandler } /** + * Destructor. + */ + public function __destruct() + { + /* This is necessary as of PHP 5.0.5 because objects are not available + * when the write() handler is called at the end of a session + * access. */ + session_write_close(); + } + + /** * Shutdown function. * * Used to determine if we need to write the session to avoid a session @@ -152,11 +163,6 @@ class Horde_SessionHandler $_SESSION['sessionhandler'] = $curr_time + (ini_get('session.gc_maxlifetime') / 2); $this->_force = true; } - - /* This is necessary as of PHP 5.0.5 because objects are not available - * when the write() handler is called at the end of a session - * access. */ - session_write_close(); } /** -- 2.11.0