diff options
author | diosmosis <diosmosis@users.noreply.github.com> | 2018-08-17 13:31:37 +0300 |
---|---|---|
committer | Matthieu Aubry <mattab@users.noreply.github.com> | 2018-08-17 13:31:37 +0300 |
commit | 46ed8c2eef4990688c1188b31bc8d8229087daab (patch) | |
tree | 6c443b84f2762efdafab8c583db716d484b458d0 /core | |
parent | 4ba679f716d18900c82a3cd1a0d303d72e59b9ff (diff) |
Do not serialize every property of Periods which can appear in DataTable metadata. (#13280)
* Do not serialize every property of Periods which can appear in DataTable metadata.
* Add test for original PHP serialized response.
Diffstat (limited to 'core')
-rw-r--r-- | core/Period.php | 12 | ||||
-rw-r--r-- | core/Period/Range.php | 20 |
2 files changed, 32 insertions, 0 deletions
diff --git a/core/Period.php b/core/Period.php index ebcad4896d..8cd849ba41 100644 --- a/core/Period.php +++ b/core/Period.php @@ -65,6 +65,18 @@ abstract class Period $this->translator = StaticContainer::get('Piwik\Translation\Translator'); } + public function __sleep() + { + return [ + 'date', + ]; + } + + public function __wakeup() + { + $this->translator = StaticContainer::get('Piwik\Translation\Translator'); + } + /** * Returns true if `$dateString` and `$period` represent multiple periods. * diff --git a/core/Period/Range.php b/core/Period/Range.php index 7073ad2c16..579fa22aa3 100644 --- a/core/Period/Range.php +++ b/core/Period/Range.php @@ -40,6 +40,10 @@ class Range extends Period */ protected $defaultEndDate; + protected $strPeriod; + protected $strDate; + protected $timezone; + /** * Constructor. * @@ -66,6 +70,22 @@ class Range extends Period $this->translator = StaticContainer::get('Piwik\Translation\Translator'); } + public function __sleep() + { + return [ + 'strPeriod', + 'strDate', + 'timezone', + 'defaultEndDate', + 'today', + ]; + } + + public function __wakeup() + { + $this->translator = StaticContainer::get('Piwik\Translation\Translator'); + } + private function getCache() { return Cache::getTransientCache(); |