Bug #54579 [Asn->Csd]: DateTime sub problem
| From: | dtajchreber@php.net | Date: | Wed, 20 Apr 2011 21:37:03 +0000 |
| Subject: | Bug #54579 [Asn->Csd]: DateTime sub problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-160315@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=54579&edit=1
ID: 54579
Updated by: dtajchreber@php.net
Reported by: me at sebastian-bechtel dot info
Summary: DateTime sub problem
-Status: Assigned
+Status: Closed
Type: Bug
Package: Date/time related
PHP Version: 5.3.6
Assigned To: derick
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
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/.
Thank you for the report, and for helping us make PHP better.
And it is indeed fixed in snapshots.
Previous Comments:
------------------------------------------------------------------------
[2011-04-20 23:33:48] dtajchreber@php.net
Looks related to #54340.
------------------------------------------------------------------------
[2011-04-20 22:44:16] me at sebastian-bechtel dot info
Description:
------------
DateTime::sub() does not work on objects created by a date string. If
the object
is created by timestamp it works.
Test script:
---------------
<?php
$dt = new DateTime('first day of this month');
// correct output: "2011-04-01 22:41:17"
var_dump($dt);
// wrong output: "2011-04-01 22:41:17"
var_dump($dt->sub(new DateInterval('P2D')));
// correct output: "2011-03-30 20:41:17"
var_dump(date_create('@' . $dt->getTimestamp())->sub(new
DateInterval('P2D')));
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=54579&edit=1