From 8f6f31dbb37bff3776ec009b16b66b5ce274e3fe Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 20 Jun 2013 13:42:19 +0000 Subject: [PATCH] * API: if re-connect to database fails for an existing session, stop execution with an exception, as otherwise eg. preferences can get lost --- phpgwapi/inc/class.egw_db.inc.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/phpgwapi/inc/class.egw_db.inc.php b/phpgwapi/inc/class.egw_db.inc.php index 4c3efe22ef..4048a3f0eb 100644 --- a/phpgwapi/inc/class.egw_db.inc.php +++ b/phpgwapi/inc/class.egw_db.inc.php @@ -452,7 +452,12 @@ class egw_db $this->Link_ID =& $GLOBALS['egw']->ADOdb; } } - if (!$this->Link_ID->isConnected()) $this->Link_ID->Connect(); + if (!$this->Link_ID->isConnected() && !$this->Link_ID->Connect()) + { + $Host = preg_replace('/password=[^ ]+/','password=$Password',$this->Host); // eg. postgres dsn contains password + $this->halt("ADOdb::$connect($Host, $this->User, \$Password, $this->Database) reconnect failed."); + return null; // in case error-reporting = 'no' + } if ($new_connection) {