Bug #70153 [Asn->Csd]: \DateInterval incorrectly unserialized

From: Date: Fri, 18 Oct 2019 13:34:46 +0000
Subject: Bug #70153 [Asn->Csd]: \DateInterval incorrectly unserialized
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223257@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70153&edit=1 ID: 70153 Updated by: cmb@php.net Reported by: php dot net at artursvonda dot lv Summary: \DateInterval incorrectly unserialized -Status: Assigned +Status: Closed Type: Bug Package: Date/time related Operating System: * PHP Version: 5.6.1 Assigned To: derick Block user comment: N Private report: N New Comment: Automatic comment on behalf of m.yakunin@8bitgroup.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=d2cde0bfd39422be3af49f6513a0a5358ef7cf63 Log: Fix #70153 \DateInterval incorrectly unserialized Previous Comments: ------------------------------------------------------------------------ [2019-09-06 15:40:00] yakuninm at gmail dot com The following pull request has been associated: Patch Name: Fix #70153 \DateInterval incorrectly unserialized On GitHub: https://github.com/php/php-src/pull/4687 Patch: https://github.com/php/php-src/pull/4687.patch ------------------------------------------------------------------------ [2015-07-27 14:28:26] cmb@php.net 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. ------------------------------------------------------------------------ [2015-07-27 14:27:24] cmb@php.net The following patch has been added/updated: Patch Name: dateinterval-unserialize Revision: 1438007244 URL: https://bugs.php.net/patch-display.php?bug=70153&patch=dateinterval-unserialize&revision=1438007244 ------------------------------------------------------------------------ [2015-07-27 13:26:47] php dot net at artursvonda dot lv Description: ------------ When unserialising DateInterval, boolean fields are stored as integers. http://3v4l.org/RkMGa Test script: --------------- $interval = \DateInterval::createFromDateString('+1 month'); var_dump($interval->days === false); var_dump(unserialize(serialize($interval))->days === false); Expected result: ---------------- bool(true) bool(true) Actual result: -------------- bool(true) bool(false) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70153&edit=1

« previous php.bugs (#223257) next »