From af44c1ac8efdfe0a6fe80dc4a8a3c352d65be3d7 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 8 Nov 2010 10:40:56 -0700 Subject: [PATCH] Fix broken serialization for Share and Group packages (at least for the Sql driver) --- framework/Group/lib/Horde/Group.php | 2 +- framework/Group/lib/Horde/Group/Sql.php | 1 + framework/Share/lib/Horde/Share.php | 6 +++--- framework/Share/lib/Horde/Share/Sql.php | 14 ++++++++------ 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/framework/Group/lib/Horde/Group.php b/framework/Group/lib/Horde/Group.php index 11093cef7..a31f69477 100644 --- a/framework/Group/lib/Horde/Group.php +++ b/framework/Group/lib/Horde/Group.php @@ -147,7 +147,7 @@ class Horde_Group */ public function shutdown() { - // TODO: Mve to core. + // TODO: Move to core. $GLOBALS['session']->store($this, false, 'horde_group'); } diff --git a/framework/Group/lib/Horde/Group/Sql.php b/framework/Group/lib/Horde/Group/Sql.php index 4e9928578..7c4173724 100644 --- a/framework/Group/lib/Horde/Group/Sql.php +++ b/framework/Group/lib/Horde/Group/Sql.php @@ -42,6 +42,7 @@ class Horde_Group_Sql extends Horde_Group */ public function __sleep() { + return array(); } /** diff --git a/framework/Share/lib/Horde/Share.php b/framework/Share/lib/Horde/Share.php index cd61cdaaf..ea23c17c3 100644 --- a/framework/Share/lib/Horde/Share.php +++ b/framework/Share/lib/Horde/Share.php @@ -133,7 +133,7 @@ class Horde_Share * (re)connect the share object to this share driver. Userful for when * share objects are unserialized from a cache separate from the share * driver. - * + * * @param Horde_Share_Object $object */ public function initShareObject($object) @@ -483,8 +483,8 @@ class Horde_Share * * @param string $type The callback to run * @param array $params The parameters to pass to the callback. - * - * @return mixed + * + * @return mixed */ public function runCallback($type, $params) { diff --git a/framework/Share/lib/Horde/Share/Sql.php b/framework/Share/lib/Horde/Share/Sql.php index 614901877..c6bbe2f5b 100644 --- a/framework/Share/lib/Horde/Share/Sql.php +++ b/framework/Share/lib/Horde/Share/Sql.php @@ -76,7 +76,9 @@ class Horde_Share_Sql extends Horde_Share implements Serializable $this->_shareMap, $this->_listcache, $this->_shareObject, - $this->_permsObject); + $this->_permsObject, + $this->_groups + ); return serialize($data); } @@ -103,7 +105,8 @@ class Horde_Share_Sql extends Horde_Share implements Serializable $this->_shareMap = $data[4]; $this->_listcache = $data[5]; $this->_shareObject = $data[6]; - $this->_permsObject = $data [7]; + $this->_permsObject = $data[7]; + $this->_groups = $data[8]; $this->_table = $this->_app . '_shares'; @@ -379,7 +382,7 @@ class Horde_Share_Sql extends Horde_Share implements Serializable foreach ($rows as $share) { $shares[(int)$share['share_id']] = $this->_fromDriverCharset($share); } - + // Get users permissions try { $rows = $this->_db->selectAll('SELECT share_id, user_uid, perm FROM ' . $this->_table . '_users'); @@ -610,7 +613,7 @@ class Horde_Share_Sql extends Horde_Share implements Serializable $tables = array($this->_table, $this->_table . '_users', $this->_table . '_groups'); - foreach ($tables as $table) { + foreach ($tables as $table) { try { $this->_db->delete('DELETE FROM ' . $table . ' WHERE share_id = ?', $params); } catch (Horde_Db_Exception $e) { @@ -631,7 +634,7 @@ class Horde_Share_Sql extends Horde_Share implements Serializable * @throws Horde_Share_Exception */ protected function _exists($share) - { + { try { return (boolean)$this->_db->selectOne('SELECT 1 FROM ' . $this->_table . ' WHERE share_name = ?', array($share)); } catch (Horde_Db_Exception $e) { @@ -674,7 +677,6 @@ class Horde_Share_Sql extends Horde_Share implements Serializable . ' AND (' . Horde_SQL::buildClause($this->_db, 'u.perm', '&', $perm) . '))'; // If the user has any group memberships, check for those also. - // @TODO: Inject the group driver try { $groups = $this->_groups->getGroupMemberships($userid, true); if ($groups) { -- 2.11.0