DateTime serialization does not work in PHP 7.4
tsufeki opened this issue · 2 comments
tsufeki commented
To reproduce:
$serializer = new \Zumba\JsonSerializer\JsonSerializer();
echo $serializer->serialize(new \DateTime()) . "\n";
echo $serializer->serialize(new \DateTimeImmutable()) . "\n";
Expected output (as in PHP up to 7.3):
{"@type":"DateTime","date":"2020-06-11 19:20:05.099012","timezone_type":3,"timezone":"Europe\/Berlin"}
{"@type":"DateTimeImmutable","date":"2020-06-11 19:20:05.099087","timezone_type":3,"timezone":"Europe\/Berlin"}
Actual output (in PHP 7.4.5):
{"@type":"DateTime"}
{"@type":"DateTimeImmutable"}
jrbasso commented
This issue is now fixed. Kudos for @przemyslaw-bogusz
tsufeki commented
Thank you.