From: Evan Prodromou Date: Mon, 18 Apr 2011 22:23:06 +0000 (-0400) Subject: Don't serialize protected attrs X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=73f4762a554884bb511c2c6ca8540b24623c51ee;p=quix0rs-gnu-social.git Don't serialize protected attrs --- diff --git a/classes/Notice.php b/classes/Notice.php index bcd84501ec..71d4d4ff23 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -2407,4 +2407,22 @@ class Notice extends Memcached_DataObject } return $this->_original; } + + /** + * Magic function called at serialize() time. + * + * We use this to drop a couple process-specific references + * from DB_DataObject which can cause trouble in future + * processes. + * + * @return array of variable names to include in serialization. + */ + + function __sleep() + { + $vars = parent::__sleep(); + $skip = array('_original', '_profile'); + return array_diff($vars, $skip); + } + } diff --git a/classes/Profile.php b/classes/Profile.php index 16484fbe6e..2638f745f7 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -1353,4 +1353,21 @@ class Profile extends Memcached_DataObject } return $profile; } + + /** + * Magic function called at serialize() time. + * + * We use this to drop a couple process-specific references + * from DB_DataObject which can cause trouble in future + * processes. + * + * @return array of variable names to include in serialization. + */ + + function __sleep() + { + $vars = parent::__sleep(); + $skip = array('_user'); + return array_diff($vars, $skip); + } } diff --git a/classes/User.php b/classes/User.php index d8f813c765..8642c78c27 100644 --- a/classes/User.php +++ b/classes/User.php @@ -983,4 +983,21 @@ class User extends Memcached_DataObject return $apps; } + + /** + * Magic function called at serialize() time. + * + * We use this to drop a couple process-specific references + * from DB_DataObject which can cause trouble in future + * processes. + * + * @return array of variable names to include in serialization. + */ + + function __sleep() + { + $vars = parent::__sleep(); + $skip = array('_profile'); + return array_diff($vars, $skip); + } }