|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70153 \DateInterval incorrectly unserialized
Submitted: 2015-07-27 13:26 UTC Modified: 2017-10-24 05:24 UTC
Avg. Score:1.0 ± 0.0
Reproduced:0 of 1 (0.0%)
From: php dot net at artursvonda dot lv Assigned: derick (profile)
Status: Assigned Package: Date/time related
PHP Version: 5.6.1 OS: *
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.
Block user comment
Status: Assign to:
Bug Type:
From: php dot net at artursvonda dot lv
New email:
PHP Version: OS:


 [2015-07-27 13:26 UTC] php dot net at artursvonda dot lv
When unserialising DateInterval, boolean fields are stored as integers.

Test script:
$interval = \DateInterval::createFromDateString('+1 month');
var_dump($interval->days === false);
var_dump(unserialize(serialize($interval))->days === false);

Expected result:

Actual result:


dateinterval-unserialize (last revision 2015-07-27 14:27 UTC by

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-27 14:27 UTC]
The following patch has been added/updated:

Patch Name: dateinterval-unserialize
Revision:   1438007244
 [2015-07-27 14:28 UTC]
-Status: Open +Status: Analyzed -Operating System: Ubuntu +Operating System: * -PHP Version: Irrelevant +PHP Version: 5.6.1 -Assigned To: +Assigned To: derick
 [2015-07-27 14:28 UTC]
I can confirm the behavior. It seems there is a special handling
missing for the days property, so that bool(false) is converted to
the proper internal representation -99999.

Derick, could you please have a look at the attached patch
"dateinterval-unserialize". I think that would solve the issue.
 [2017-10-24 05:24 UTC]
-Status: Analyzed +Status: Assigned
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Sun Dec 09 19:01:25 2018 UTC