symfony / symfony

The Symfony PHP framework
https://symfony.com
MIT License
29.79k stars 9.47k forks source link

[Serializer] Serialization issue on DateTime objects by using PHP 5.4.35-0+deb7u2 #13000

Closed lcotonea closed 9 years ago

lcotonea commented 9 years ago

Hi,

On the Debian Wheezy distribution, since the last update of PHP5 to the version 5.4.35-0+deb7u2, the Serializer component seems to have an issue on the DateTime format. The problem occurs periodically and is reproducible with difficulties.

In my test environment, the problem occurs when I want to read data that are stored into the Redis Server. Examples:

[{"message":"Error: Invalid serialization data for DateTime object in \/var\/www\/XXXX\/front\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/Security\/Core\/Authentication\/Token\/AbstractToken.php line 163","class":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","trace":[{"namespace":"","short_class":"","class":"","type":"","function":"","file":"\/var\/www\/XXXX\/front\/vendor\/symfony\/symfony\/src\/Symfony\/Component\/Security\/Core\/Authentication\/Token\/AbstractToken.php","line":163,"args":[]}]}]

{"message":"Error: Invalid serialization data for DateTime object in \/var\/www\/XXXX\/front\/src\/XXXX\/APIBundle\/Service\/YYYYService.php line 144","class":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","trace":[{"namespace":"","short_class":"","class":"","type":"","function":"","file":"\/var\/www\/XXXX\/front\/src\/XXXX\/APIBundle\/Service\/YYYYService.php","line":144,"args":[]}]}]

I've found a recent bug report in the EZPublish project that seems to be built on Symfony 2 components: https://jira.ez.no/browse/EZP-23713. Attached files to this issue are interesting because we have a valid and an invalid DateTime serialization.

Then I've downgraded my Debian Wheezy PHP5 package to this version : 5.4.4-14+deb7u14 , and the problem doesn't exists. It's probably a PHP5 bug or a Debian code merge problem but with big impacts on Symfony use in a production environment. I don't have enough technical element to push this issue to the PHP project.

dunglas commented 9 years ago

This bug seems not related with the Serializer component but with the serialize() PHP function.

Anyway, can you provide the serialized data stored in your Redis? The Debian patch probably affected the way PHP serializes DateTime objects (and Symfony can do nothing for that).

lcotonea commented 9 years ago

I agree with you. I have reported this issue also to add visibility for others Symfony users (just in case). Moreover I've reported this bug at Debian.

jakzal commented 9 years ago

@lcotonea could you link to the debian issue here please?

fabpot commented 9 years ago

Closing as it seems to be a bug in PHP. Even closed, people will still be able to find it. Thanks for letting us know. It would be great if you can also comment here if you ever have some feedback from your bug report there.

lcotonea commented 9 years ago

Hi,

Here the bug report : https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774975

lcotonea commented 9 years ago

According to the Debian PHP 5 package maintainer, this origin of this bug seems to be in PHP. Here the bug report : https://bugs.php.net/bug.php?id=68889&thanks=6