The write/close should be done in the destructor
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 8 Oct 2009 22:23:15 +0000 (16:23 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 8 Oct 2009 22:23:15 +0000 (16:23 -0600)
framework/SessionHandler/lib/Horde/SessionHandler.php

index 54812df..b12cf55 100644 (file)
@@ -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();
     }
 
     /**