summaryrefslogtreecommitdiff
path: root/framework/Web/UI/TControl.php
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2016-02-25 17:01:17 +0100
committerFabio Bas <ctrlaltca@gmail.com>2016-02-25 17:01:17 +0100
commit562e322fe595b4d3307ff28a96c8c5fbcc284010 (patch)
tree4b16f146c8ee931dc084758798cfdb32f64b914b /framework/Web/UI/TControl.php
parent294682fb45014ba04ce1b193af712208b15a6151 (diff)
Applied some misc optimizations to class serialization
Avoid saving in the page state the values of class variables if they’re still the default. Reduces page state size, based on the work initiated in 8dc9d4f7d49bcbeaf4998baf74a4f4459967c1f0
Diffstat (limited to 'framework/Web/UI/TControl.php')
-rw-r--r--framework/Web/UI/TControl.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php
index 055b5521..afe1daa3 100644
--- a/framework/Web/UI/TControl.php
+++ b/framework/Web/UI/TControl.php
@@ -769,13 +769,19 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable
{
if($this->_trackViewState)
{
- $this->_viewState[$key]=$value;
unset($this->_tempState[$key]);
+ if($value===$defaultValue)
+ unset($this->_viewState[$key]);
+ else
+ $this->_viewState[$key]=$value;
}
else
{
unset($this->_viewState[$key]);
- $this->_tempState[$key]=$value;
+ if($value===$defaultValue)
+ unset($this->_tempState[$key]);
+ else
+ $this->_tempState[$key]=$value;
}
}
@@ -1655,7 +1661,10 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable
foreach($this->_rf[self::RF_CONTROLS] as $control)
{
if($control instanceof TControl)
- $state[$control->_id]=&$control->saveStateRecursive($needViewState);
+ {
+ if(count($tmp = &$control->saveStateRecursive($needViewState)))
+ $state[$control->_id]=$tmp;
+ }
}
}
if($needViewState && !empty($this->_viewState))