dto
dto copied to clipboard
Error on unserialize serialized dto object
Hi!
I have some problems with unserialise of dto objects. It throw 'UnexpectedValueException with message 'Error at offset 0 of XX bytes''
Sample:
$ser = serialize(new Dto\Dto);
$obj = unserialize($ser);
After examining the code in the file Dto.php, I found the reason. The Dot class has an implementation of the serialize method, in which the JSON representation of the object is returned. But I did not find the method of unserialize. An example of the non-existent method:
final public function unserialize($serialized) {
return static::__construct(json_decode($serialized, true));
}