dto icon indicating copy to clipboard operation
dto copied to clipboard

Error on unserialize serialized dto object

Open dzhiryakov opened this issue 6 years ago • 0 comments

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));
}

dzhiryakov avatar Jun 18 '18 11:06 dzhiryakov