diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-08-28 11:43:35 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2024-08-30 14:31:29 +0200 |
| commit | 874ef1f5a226e537bd0e244a787e1e5a558affa4 (patch) | |
| tree | 37d9117723873d991cc655a1d951ae14cc62e6a2 /lib/classes/StudipArrayObject.class.php | |
| parent | 2fd07f0b4479d0f76bf82c36ba90d166b6775522 (diff) | |
fix unserialization of StudipArrayObjects, remove deprecated Serializable...
Closes #4537
Merge request studip/studip!3333
Diffstat (limited to 'lib/classes/StudipArrayObject.class.php')
| -rw-r--r-- | lib/classes/StudipArrayObject.class.php | 45 |
1 files changed, 3 insertions, 42 deletions
diff --git a/lib/classes/StudipArrayObject.class.php b/lib/classes/StudipArrayObject.class.php index ec915a6..47f116b 100644 --- a/lib/classes/StudipArrayObject.class.php +++ b/lib/classes/StudipArrayObject.class.php @@ -14,7 +14,7 @@ * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ -class StudipArrayObject implements IteratorAggregate, ArrayAccess, Serializable, Countable +class StudipArrayObject implements IteratorAggregate, ArrayAccess, Countable { /** * Properties of the object have their normal functionality @@ -147,6 +147,8 @@ class StudipArrayObject implements IteratorAggregate, ArrayAccess, Serializable, */ public function __unserialize(array $data): void { + $this->protectedProperties = array_keys(get_object_vars($this)); + foreach ($data as $k => $v) { switch ($k) { case 'flag': @@ -371,16 +373,6 @@ class StudipArrayObject implements IteratorAggregate, ArrayAccess, Serializable, } /** - * Serialize an ArrayObject - * - * @return string - */ - public function serialize() - { - return serialize(get_object_vars($this)); - } - - /** * Sets the behavior flags * * @param int $flags @@ -444,37 +436,6 @@ class StudipArrayObject implements IteratorAggregate, ArrayAccess, Serializable, } /** - * Unserialize an ArrayObject - * - * @param string $data - * @return void - */ - public function unserialize($data) - { - $ar = unserialize($data); - $this->setFlags($ar['flag']); - $this->exchangeArray($ar['storage']); - $this->setIteratorClass($ar['iteratorClass']); - foreach ($ar as $k => $v) { - switch ($k) { - case 'flag': - $this->setFlags($v); - break; - case 'storage': - $this->exchangeArray($v); - break; - case 'iteratorClass': - $this->setIteratorClass($v); - break; - case 'protectedProperties': - break; - default: - $this->__set($k, $v); - } - } - } - - /** * Validates whether the given key is a protected property. * * @param string $key The key to validate |
