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:08 +0200
commit9a040a536e7a0caf327d87f31da502c661faf690 (patch)
tree6beb5ed241bc18e645caf6d4f0d8066dfd9246a2 /lib/classes/StudipArrayObject.class.php
parent5e4d58cd48af38d0ff8ae4ef242e8ad379e0dfd9 (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