Bug #70926 [Opn->Nab]: Negative time period in DateInterval::createFromDateString
| From: | derick@php.net | Date: | Tue, 17 Nov 2015 11:12:57 +0000 |
| Subject: | Bug #70926 [Opn->Nab]: Negative time period in DateInterval::createFromDateString | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-197294@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70926&edit=1
ID: 70926
Updated by: derick@php.net
Reported by: red dot led0 at gmail dot com
Summary: Negative time period in
DateInterval::createFromDateString
-Status: Open
+Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 5.6.15
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is correct. The "invert" property is only used when you compare two DateTime objects
and the first one is after the second one.
Previous Comments:
------------------------------------------------------------------------
[2015-11-17 08:49:41] red dot led0 at gmail dot com
Description:
------------
Passing negative time period to DateInterval::createFromDateString causes to creating DateInterval
with negative values instead setting 'invert' flag
Test script:
---------------
$period = \DateInterval::createFromDateString('-1 day');
var_dump($period->d, $period->invert);
Expected result:
----------------
int(1)
int(1)
Actual result:
--------------
int(-1)
int(0)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70926&edit=1