Bug #71525 [Opn->Csd]: Calls to date_modify will mutate timelib_rel_time, causing date_date_set issues
| From: | ab@php.net | Date: | Mon, 15 Feb 2016 07:22:29 +0000 |
| Subject: | Bug #71525 [Opn->Csd]: Calls to date_modify will mutate timelib_rel_time, causing date_date_set issues | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-199218@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71525&edit=1
ID: 71525
Updated by: ab@php.net
Reported by: seander@php.net
Summary: Calls to date_modify will mutate timelib_rel_time,
causing date_date_set issues
-Status: Open
+Status: Closed
Type: Bug
Package: Date/time related
Operating System: All
PHP Version: 7.0.3
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of sean@siobud.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f31e0cd3345ab1d0b4a5f82a804b2a8868a307e1
Log: Fix bug #71525
Previous Comments:
------------------------------------------------------------------------
[2016-02-04 21:00:50] seander@php.net
Description:
------------
timelib_time->timelib_rel_time is mutated by date_modify, and because it is never zero'ed
out it latters causes other date operations to fail (like date_date_set)
A reproduce is attached, and I will open a PR with a possible patch.
Test script:
---------------
<?php
$date = new DateTime('2011-12-25 00:00:00');
$date->modify('first day of next month');
$date->setDate('2012', '1', '29');
var_dump($date);
----
https://3v4l.org/PASOu
Expected result:
----------------
object(DateTime)#1 (3) {
["date"]=>
string(26) "2012-01-29 00:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(16) "Europe/Amsterdam"
}
Actual result:
--------------
object(DateTime)#1 (3) {
["date"]=>
string(26) "2012-01-01 00:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(16) "Europe/Amsterdam"
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71525&edit=1