php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45682 Unable to var_dump(DateInterval)
Submitted: 2008-08-01 19:15 UTC Modified: 2009-05-03 18:46 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: hannes dot magnusson at gmail dot com Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5.3CVS-2008-11-11 OS: *
Private report: No CVE-ID: None
 [2008-08-01 19:15 UTC] hannes dot magnusson at gmail dot com
Description:
------------
The DateInterval does not seem to expose its properties to var_dump().. 

Reproduce code:
---------------
bjori@lohan:~$ cat test.php 
<?php

$date = new DateTime("28-July-2008");
$other = new DateTime("31-July-2008");

$diff = date_diff($date, $other);

var_dump($diff);
echo $diff, "\n";

bjori@lohan:~$ ~/php/5.3/sapi/cli/php test.php 
object(DateInterval)#3 (0) {
}

Catchable fatal error: Object of class DateInterval could not be converted to string in /crypto/bjori/test.php on line 9


Expected result:
----------------
The properties to retrieve the actual difference.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-03 18:46 UTC] derick@php.net
This bug has been fixed in CVS.

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.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC