|  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:2.0 ± 1.0
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: php dot net at artursvonda dot lv Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5.6.1 OS: *
Private report: No CVE-ID: None
 [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

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
 [2019-09-06 15:40 UTC] yakuninm at gmail dot com
The following pull request has been associated:

Patch Name: Fix #70153 \DateInterval incorrectly unserialized
On GitHub:
 [2019-10-18 13:34 UTC]
Automatic comment on behalf of
Log: Fix #70153 \DateInterval incorrectly unserialized
 [2019-10-18 13:34 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Oct 04 23:01:25 2023 UTC