diff options
author | ctrlaltca@gmail.com <> | 2011-06-26 09:56:56 +0000 |
---|---|---|
committer | ctrlaltca@gmail.com <> | 2011-06-26 09:56:56 +0000 |
commit | 8dc9d4f7d49bcbeaf4998baf74a4f4459967c1f0 (patch) | |
tree | f2a1a3ddb20418e78e4f0b445866ac2605bff736 /framework/TComponent.php | |
parent | f5a87398433ebecefbc62d4fead8a178e32a1f26 (diff) |
applied serialization optimization patch (337)
Diffstat (limited to 'framework/TComponent.php')
-rw-r--r-- | framework/TComponent.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/framework/TComponent.php b/framework/TComponent.php index ea204011..dbcf4a60 100644 --- a/framework/TComponent.php +++ b/framework/TComponent.php @@ -451,6 +451,31 @@ class TComponent public function addParsedObject($object) { } + + /** + * Do not call this method. This is a PHP magic method that will be called automatically + * after any unserialization; it can perform reinitialization tasks on the object. + */ + public function __wakeup() + { + if ($this->_e===null) + $this->_e = array(); + } + + /** + * Returns an array with the names of all variables of that object that should be serialized. + * Do not call this method. This is a PHP magic method that will be called automatically + * prior to any serialization. + */ + public function __sleep() + { + $a = (array)$this; + $a = array_keys($a); + $exprops = array(); + if ($this->_e===array()) + $exprops[] = "\0TComponent\0_e"; + return array_diff($a,$exprops); + } } /** |