Skip to content
Snippets Groups Projects
Commit c45c701b authored by Marcus Eibrink-Lunzenauer's avatar Marcus Eibrink-Lunzenauer Committed by Jan-Hendrik Willms
Browse files

Add __(un)serialize to `StudipArrayObject` to remove Warnings.

Closes #4135

Merge request studip/studip!3098
parent f019ad32
No related branches found
No related tags found
No related merge requests found
...@@ -134,6 +134,38 @@ class StudipArrayObject implements IteratorAggregate, ArrayAccess, Serializable, ...@@ -134,6 +134,38 @@ class StudipArrayObject implements IteratorAggregate, ArrayAccess, Serializable,
return $this->$key; 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 * Appends the value
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment