#49778 [NEW]: DateInterval::format("%a") is always zero

From: Date: Mon, 05 Oct 2009 14:32:08 +0000
Subject: #49778 [NEW]: DateInterval::format("%a") is always zero
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-143276@lists.php.net to get a copy of this message
From:             jenwelsh at yahoo dot com
Operating system: Solaris 10
PHP version:      5.3.0
PHP Bug Type:     Date/time related
Bug description:  DateInterval::format("%a") is always zero

Description:
------------
DateInterval cannot output the total days. It always outputs 0.

Reproduce code:
---------------
---
From manual page: dateinterval.format#Return Values
---

$i=new DateInterval('P7D');
print_r($i);
echo $i->format("%d");
echo $i->format("%a");

Expected result:
----------------
DateInterval Object
(
    [y] => 0
    [m] => 0
    [d] => 7
    [h] => 0
    [i] => 0
    [s] => 0
    [invert] => 0
    [days] => 0
)
7
7

Actual result:
--------------
DateInterval Object
(
    [y] => 0
    [m] => 0
    [d] => 7
    [h] => 0
    [i] => 0
    [s] => 0
    [invert] => 0
    [days] => 0
)
7
0

-- 
Edit bug report at http://bugs.php.net/?id=49778&edit=1
-- 
Try a snapshot (PHP 5.2):            http://bugs.php.net/fix.php?id=49778&r=trysnapshot52
Try a snapshot (PHP 5.3):            http://bugs.php.net/fix.php?id=49778&r=trysnapshot53
Try a snapshot (PHP 6.0):            http://bugs.php.net/fix.php?id=49778&r=trysnapshot60
Fixed in SVN:                        http://bugs.php.net/fix.php?id=49778&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49778&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=49778&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=49778&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=49778&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=49778&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=49778&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=49778&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=49778&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=49778&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=49778&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=49778&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=49778&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=49778&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=49778&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=49778&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=49778&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=49778&r=mysqlcfg



Thread (11 messages)

« previous php.bugs (#143276) next »