Don't serialize protected attrs

This commit is contained in:
Evan Prodromou 2011-04-18 18:23:06 -04:00
parent 3fd6b9d474
commit 73f4762a55
3 changed files with 52 additions and 0 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}