diff --git a/phpgwapi/inc/class.egw_db.inc.php b/phpgwapi/inc/class.egw_db.inc.php index 367a87d802..5916f439e3 100644 --- a/phpgwapi/inc/class.egw_db.inc.php +++ b/phpgwapi/inc/class.egw_db.inc.php @@ -584,6 +584,24 @@ class egw_db $this->connect(); // we need to re-connect } + /** + * Magic method called when object get's serialized + * + * We do NOT store Link_ID and private_Link_ID, as we need to reconnect anyway. + * This also ensures reevaluating environment-data or multiple hosts in connection-data! + * + * @return array + */ + function __sleep() + { + if (!empty($this->setupType)) $this->Type = $this->setupType; // restore Type eg. to mysqli + + $vars = get_object_vars($this); + unset($vars['Link_ID']); + unset($vars['privat_Link_ID']); + return array_keys($vars); + } + /** * changes defaults set in class-var $capabilities depending on db-type and -version * @@ -639,7 +657,7 @@ class egw_db unset($this->Link_ID); $this->Link_ID = 0; - if (!empty($this->setupType)) $this->type = $this->setupType; + if (!empty($this->setupType)) $this->Type = $this->setupType; } /**