<?php
class A implements \Serializable
{
public function serialize()
{
$dt = new \DateTime();
return serialize(array($dt, serialize([$dt])));
}
public function unserialize($serialized)
{
$a = unserialize($serialized);
unserialize($a[1]);
}
}
$a = new A();
$s = serialize($a);
$d = unserialize($s);
Deprecated: A implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /in/QhgoL on line 3
Warning: unserialize(): Error at offset 13 of 165 bytes in /in/QhgoL on line 13
Warning: Trying to access array offset on false in /in/QhgoL on line 14
Deprecated: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in /in/QhgoL on line 14
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Deprecated: A implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /in/QhgoL on line 3
Notice: unserialize(): Error at offset 13 of 165 bytes in /in/QhgoL on line 13
Warning: Trying to access array offset on value of type bool in /in/QhgoL on line 14
Deprecated: unserialize(): Passing null to parameter #1 ($data) of type string is deprecated in /in/QhgoL on line 14
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30
Notice: unserialize(): Error at offset 13 of 165 bytes in /in/QhgoL on line 13
Warning: Trying to access array offset on value of type bool in /in/QhgoL on line 14
Output for 8.0.13
Notice: unserialize(): Error at offset 13 of 151 bytes in /in/QhgoL on line 13
Warning: Trying to access array offset on value of type bool in /in/QhgoL on line 14
Output for 7.4.0 - 7.4.33
Notice: unserialize(): Error at offset 13 of 165 bytes in /in/QhgoL on line 13
Notice: Trying to access array offset on value of type bool in /in/QhgoL on line 14