aboutsummaryrefslogtreecommitdiff
path: root/lib/classes/StudipArrayObject.class.php
diff options
context:
space:
mode:
authorMarcus Eibrink-Lunzenauer <lunzenauer@elan-ev.de>2024-06-14 08:59:22 +0000
committerJan-Hendrik Willms <tleilax+github@gmail.com>2024-08-30 14:31:05 +0200
commit2fd07f0b4479d0f76bf82c36ba90d166b6775522 (patch)
treee43eece8713c3c0980592359b85b4eef39326979 /lib/classes/StudipArrayObject.class.php
parent3f39f080be79128eea486a502cb4ed844aa8a5c4 (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.php32
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