php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68889 Serialization issue on DateTime objects by using PHP 5.4.35-0+deb7u2
Submitted: 2015-01-22 14:47 UTC Modified: 2016-10-30 04:22 UTC
Votes:27
Avg. Score:4.4 ± 0.7
Reproduced:26 of 26 (100.0%)
Same Version:9 (34.6%)
Same OS:12 (46.2%)
From: loic dot cotonea at sogeti dot com Assigned:
Status: No Feedback Package: Reflection related
PHP Version: 5.4.36 OS: Debian Wheezy
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: loic dot cotonea at sogeti dot com
New email:
PHP Version: OS:

 

 [2015-01-22 14:47 UTC] 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.




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-29 11:51 UTC] intercity at massiveimpact dot ch
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'),
 [2016-10-19 11:41 UTC] adam dot conway at carus dot com
Just had this with PHP 5.4.45 on Centos 6.5.  From session_start()
 [2016-10-19 11:43 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2016-10-19 11:43 UTC] requinix@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

Can anyone reproduce this on a version of PHP still in active support?
 [2016-10-30 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 06:01:28 2024 UTC