From 8dc9d4f7d49bcbeaf4998baf74a4f4459967c1f0 Mon Sep 17 00:00:00 2001 From: "ctrlaltca@gmail.com" <> Date: Sun, 26 Jun 2011 09:56:56 +0000 Subject: applied serialization optimization patch (337) --- framework/TComponent.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'framework/TComponent.php') 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); + } } /** -- cgit v1.2.3