Bug #73294 [Opn->Csd]: DateTime wrong when date string is negative
| From: | derick@php.net | Date: | Sun, 12 Feb 2017 20:20:14 +0000 |
| Subject: | Bug #73294 [Opn->Csd]: DateTime wrong when date string is negative | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-207296@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73294&edit=1
ID: 73294
Updated by: derick@php.net
Reported by: andrmoel at googlemail dot com
Summary: DateTime wrong when date string is negative
-Status: Open
+Status: Closed
Type: Bug
Package: Date/time related
Operating System: Ubuntu
PHP Version: 7.0.11
-Assigned To:
+Assigned To: derick
Block user comment: N
Private report: N
New Comment:
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2017-02-12 17:55:02] derick@php.net
I have a fix and test case for this, which I'll merge when I make a new timelib release
(shortly).
------------------------------------------------------------------------
[2016-10-11 16:42:05] andrmoel at googlemail dot com
Description:
------------
When you run the test script, the second outpot is parsed false. It returns the date minus one day.
Maybe this error occures with other strings also.
Test script:
---------------
<?php
$dt = new DateTime('-1999-06-22 00:00:00');
echo "\nThis should be -1999-06-22 00:00:00 -> " . $dt->format('Y-m-d
H:i:s');
$dt = new DateTime('-1916-06-22 00:00:00');
echo "\nThis should be -1916-06-22 00:00:00 -> " . $dt->format('Y-m-d
H:i:s');
Expected result:
----------------
This should be -1999-06-22 00:00:00 -> -1999-06-22 00:00:00
This should be -1916-06-22 00:00:00 -> -1916-06-22 00:00:00
Actual result:
--------------
This should be -1999-06-22 00:00:00 -> -1999-06-22 00:00:00
This should be -1916-06-22 00:00:00 -> -1916-06-21 00:00:00
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73294&edit=1