aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarcus Eibrink-Lunzenauer <lunzenauer@elan-ev.de>2024-06-14 08:59:22 +0000
committerMarcus Eibrink-Lunzenauer <lunzenauer@elan-ev.de>2024-06-14 08:59:22 +0000
commit2df5804d3d034db26cef5a9ca8c584be3222c074 (patch)
treeee9675c7c79e687e839a6d1fdfeccf1c5d1f2a25 /lib
parente32eea963ad73556dcb2d4ec15b015c644898706 (diff)
Add __(un)serialize to `StudipArrayObject` to remove Warnings.
Closes #4135 Merge request studip/studip!3098
Diffstat (limited to 'lib')
-rw-r--r--lib/classes/StudipArrayObject.class.php32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/classes/StudipArrayObject.class.php b/lib/classes/StudipArrayObject.class.php
index 531da67..da7e66e 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