diff options
| author | Marcus Eibrink-Lunzenauer <lunzenauer@elan-ev.de> | 2024-06-14 08:59:22 +0000 |
|---|---|---|
| committer | Jan-Hendrik Willms <tleilax+github@gmail.com> | 2024-08-30 14:31:03 +0200 |
| commit | c45c701b062f68722701e847afe00f5019e51dcc (patch) | |
| tree | 7797555169fc012218b440fe3ca66dd1c7e1a3aa /lib/classes/StudipArrayObject.class.php | |
| parent | f019ad32c5d8bd1e5fdae59757782f21952c19fc (diff) | |
Add __(un)serialize to `StudipArrayObject` to remove Warnings.
Closes #4135
Merge request studip/studip!3098
Diffstat (limited to 'lib/classes/StudipArrayObject.class.php')
| -rw-r--r-- | lib/classes/StudipArrayObject.class.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/classes/StudipArrayObject.class.php b/lib/classes/StudipArrayObject.class.php index fe9aad1..ec915a6 100644 --- a/lib/classes/StudipArrayObject.class.php +++ b/lib/classes/StudipArrayObject.class.php @@ -135,6 +135,38 @@ class StudipArrayObject implements IteratorAggregate, ArrayAccess, Serializable, } /** + * Called when serializing an ArrayObject + */ + public function __serialize(): array + { + return get_object_vars($this); + } + + /** + * Called when unserializing an ArrayObject + */ + public function __unserialize(array $data): void + { + foreach ($data 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); + } + } + } + + /** * Appends the value * * @param mixed $value |
