Bug #68889 [Com]: Serialization issue on DateTime objects by using PHP 5.4.35-0+deb7u2

From: Date: Wed, 29 Apr 2015 11:51:07 +0000
Subject: Bug #68889 [Com]: Serialization issue on DateTime objects by using PHP 5.4.35-0+deb7u2
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192394@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68889&edit=1

 ID:                 68889
 Comment by:         intercity at massiveimpact dot ch
 Reported by:        loic dot cotonea at sogeti dot com
 Summary:            Serialization issue on DateTime objects by using PHP
                     5.4.35-0+deb7u2
 Status:             Open
 Type:               Bug
 Package:            Reflection related
 Operating System:   Debian Wheezy
 PHP Version:        5.4.36
 Block user comment: N
 Private report:     N

 New Comment:

In mycase https://github.com/symfony/symfony/issues/3691#issuecomment-9831914
helped me.
I had to add the format to the serialize like so:
 public function serialize() {
        return \serialize(array(
              $this->myDateTimeObj->format('Y-m-d H:i:s'),


Previous Comments:
------------------------------------------------------------------------
[2015-01-22 14:47:30] loic dot cotonea at sogeti dot com

Description:
------------
On the Debian Wheezy distribution, since the last update of PHP5 to the version 5.4.35-0+deb7u2, the
serialization of DateTime seems to be broken.
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:

During the authentication, when the problem occurs, the stack trace is :
[{"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":[]}]}]

Another example during data retrieval from cache:
{"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.





------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=68889&edit=1


Thread (5 messages)

« previous php.bugs (#192394) next »