diff options
| author | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-08-28 11:43:35 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+studip@gmail.com> | 2024-08-28 11:43:35 +0000 |
| commit | 09e2bf5ae199e147b55148f6aff22dba662198df (patch) | |
| tree | f47ff03e76a5f44b98de4a9ad837f7c6087568c0 /lib/classes/StudipArrayObject.php | |
| parent | 353d62ab03aa9ce430da047afa4ff6797b065c44 (diff) | |
fix unserialization of StudipArrayObjects, remove deprecated Serializable...
Closes #4537
Merge request studip/studip!3333
Diffstat (limited to 'lib/classes/StudipArrayObject.php')
| -rw-r--r-- | lib/classes/StudipArrayObject.php | 45 |
1 files changed, 3 insertions, 42 deletions
diff --git a/lib/classes/StudipArrayObject.php b/lib/classes/StudipArrayObject.php index da7e66e..a93d9d3 100644 --- a/lib/classes/StudipArrayObject.php +++ b/lib/classes/StudipArrayObject.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': @@ -345,16 +347,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 @@ -418,37 +410,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 |
