Skip to content
Snippets Groups Projects
Commit 2df5804d authored by Marcus Eibrink-Lunzenauer's avatar Marcus Eibrink-Lunzenauer
Browse files

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

Closes #4135

Merge request studip/studip!3098
parent e32eea96
No related branches found
No related tags found
No related merge requests found
......@@ -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
*
......
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