Bug #49778 [Csd]: DateInterval::format("%a") is always zero
| From: | jani@php.net | Date: | Sun, 07 Mar 2010 18:00:03 +0000 |
| Subject: | Bug #49778 [Csd]: DateInterval::format("%a") is always zero | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-148364@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=49778&edit=1
ID: 49778
Updated by: jani@php.net
Reported by: jenwelsh at yahoo dot com
Summary: DateInterval::format("%a") is always zero
Status: Closed
Type: Bug
Package: Date/time related
Operating System: Solaris 10
PHP Version: 5.3.0
Assigned To: derick
New Comment:
Derick made a small typo in his commit message, so here's the diff:
Revision: http://svn.php.net/viewvc/?view=revision&revision=295928
Previous Comments:
------------------------------------------------------------------------
[2010-03-07 18:23:42] derick@php.net
Automatic comment from SVN on behalf of derick
Revision: http://svn.php.net/viewvc/?view=revision&revision=295932
Log: - Update test cases after the fix for bug #49778.
------------------------------------------------------------------------
[2010-03-07 16:27:28] derick@php.net
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.
This is fixed in SVN. Instead of returning 0 (or 7), the property dump
will return bool(false) and the %a formatting specifier will return
"(unknown)".
------------------------------------------------------------------------
[2010-03-02 12:13:36] yoarvi at gmail dot com
I've attached a patch that sets the number of days value to the correct
one only when the DateInterval spans neither years nor months. The patch
only addresses the original problem reported in this bug report i.e. in
DateInterval's constructor.
The DateTime::diff() issue belongs in a separate bug.
------------------------------------------------------------------------
[2010-02-22 22:40:18] johnphayes at gmail dot com
It probably should have a different bug for the Windows "6015" bug. Just
noting that this is what I'm seeing as well, not the original bug
description.
------------------------------------------------------------------------
[2010-01-26 17:51:02] hellbringer at gmail dot com
$d1 = new DateTime('2010-01-01');
$d2 = new DateTime('2010-01-26');
$diff = $d1->diff($d2);
echo phpversion();
// 5.3.1
echo $_SERVER['SERVER_SOFTWARE'];
// Apache/2.2.11 (Win32) PHP/5.3.1
echo $diff->format('%a');
// 6015
echo $diff->days;
// 6015
print_r($diff);
// DateInterval Object
// (
// [y] => 0
// [m] => 0
// [d] => 25
// [h] => 0
// [i] => 0
// [s] => 0
// [invert] => 0
// [days] => 6015
// )
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=49778
--
Edit this bug report at http://bugs.php.net/bug.php?id=49778&edit=1