diff --git a/lib/classes/StudipArrayObject.class.php b/lib/classes/StudipArrayObject.class.php index 531da670d8d94975a6f1feddb7c420a983c343ab..da7e66eb677ec5529abf148fcf58750a310ff417 100644 --- a/lib/classes/StudipArrayObject.class.php +++ b/lib/classes/StudipArrayObject.class.php @@ -134,6 +134,38 @@ class StudipArrayObject implements IteratorAggregate, ArrayAccess, Serializable, return $this->$key; } + /** + * 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 *