]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Don't serialize protected attrs
authorEvan Prodromou <evan@status.net>
Mon, 18 Apr 2011 22:23:06 +0000 (18:23 -0400)
committerEvan Prodromou <evan@status.net>
Mon, 18 Apr 2011 22:23:06 +0000 (18:23 -0400)
classes/Notice.php
classes/Profile.php
classes/User.php

index bcd84501ec18fd2c2330a9b4b6c478fd7434d82c..71d4d4ff23bff6f225a9eec6d4e2c507b840f63a 100644 (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);
+    }
+
 }
index 16484fbe6ebfbbca38d6eaabb67cd72a4f4410aa..2638f745f71227598cc9af97b2369470bafd1b16 100644 (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);
+    }
 }
index d8f813c765911ba9b433c97bcf03520b25ae6d31..8642c78c273c15308b4f2c5c2f32c597656edadd 100644 (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);
+    }
 }