From: pierre dot inglebert at insa-rennes dot fr
Operating system: Debian Lenny
PHP version: 5.3.0RC4
PHP Bug Type: Date/time related
Bug description: DateInterval::format() doesn't work
Description:
------------
DateInterval::format method just returns the parameter given.
Reproduce code:
---------------
<?php
$date1 = new DateTime('2009-06-19 20:00:00');
$date2 = new DateTime('2009-06-19 20:00:40');
$diff = $date1->diff($date2,TRUE);
print_r($diff);
var_dump($diff->format('H:i:s'));
var_dump($diff->format('Y-m-d H:i:s'));
?>
Expected result:
----------------
DateInterval Object
(
[y] => 0
[m] => 0
[d] => 0
[h] => 0
[i] => 0
[s] => 40
[invert] => 0
[days] => 0
)
string(5) "00:00:40"
string(11) "0000-00-00 00:00:40"
Actual result:
--------------
DateInterval Object
(
[y] => 0
[m] => 0
[d] => 0
[h] => 0
[i] => 0
[s] => 40
[invert] => 0
[days] => 0
)
string(5) "H:i:s"
string(11) "Y-m-d H:i:s"
--
Edit bug report at http://bugs.php.net/?id=48609&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48609&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48609&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48609&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48609&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=48609&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48609&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=48609&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=48609&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=48609&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=48609&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=48609&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=48609&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=48609&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48609&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48609&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48609&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=48609&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=48609&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=48609&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=48609&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=48609&r=mysqlcfg