From b55e2b7e2de47e948d2899a44fb996194d193441 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Wed, 10 Aug 2011 15:12:11 +0000
Subject: [PATCH] Fix for:
 http://bugtracker.ispconfig.org/index.php?do=details&task_id=1671 Added
 destructor and session write to app class instead.

---
 interface/lib/app.inc.php              | 5 +++++
 interface/lib/classes/db_mysql.inc.php | 4 ----
 interface/web/login/logout.php         | 1 +
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/interface/lib/app.inc.php b/interface/lib/app.inc.php
index 32b591818..fbe5bd004 100644
--- a/interface/lib/app.inc.php
+++ b/interface/lib/app.inc.php
@@ -75,6 +75,11 @@ class app {
 
 		$this->uses('auth,plugin,functions');
 	}
+	
+	public function __destruct() {
+		session_write_close();
+		if(isset($this->db)) $this->db->closeConn();
+	}
 
 	public function uses($classes) {
 		$cl = explode(',', $classes);
diff --git a/interface/lib/classes/db_mysql.inc.php b/interface/lib/classes/db_mysql.inc.php
index 4572dacc8..5e38e3b50 100644
--- a/interface/lib/classes/db_mysql.inc.php
+++ b/interface/lib/classes/db_mysql.inc.php
@@ -54,10 +54,6 @@ class db {
 		//$this->connect();
 	}
 
-	public function __destruct() {
-		$this->closeConn();
-	}
-
 	/**  Error handler */
 	public function updateError($location)
     {
diff --git a/interface/web/login/logout.php b/interface/web/login/logout.php
index 912a430b3..57b76a367 100644
--- a/interface/web/login/logout.php
+++ b/interface/web/login/logout.php
@@ -64,6 +64,7 @@ $app->plugin->raiseEvent('logout',true);
 $_SESSION["s"]["user"] = null;
 $_SESSION["s"]["module"] = null;
 $_SESSION['s_old'] = null;
+session_write_close();
 
 //header("Location: ../index.php?phpsessid=".$_SESSION["s"]["id"]);
 
-- 
GitLab