php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25403 Problem with VT_DATE
Submitted: 2003-09-06 10:27 UTC Modified: 2003-09-07 11:33 UTC
From: m dot melloff at mptronic dot com Assigned:
Status: Wont fix Package: COM related
PHP Version: 4.3.2 OS: WindowsXP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: m dot melloff at mptronic dot com
New email:
PHP Version: OS:

 

 [2003-09-06 10:27 UTC] m dot melloff at mptronic dot com
Description:
------------
Problem when retrieving a VT_DATE in a COM object if the date is < to 01/01/1970

the code works fine with with any date > 01/01/1970 

the problem is VT_Date can start at 01/01/1901 and $DOB->Value returns a timestamp starting from 1970 instead of 1901. While it makes easy to format the VT_Date with Date($format,$timestamp) it does not alow to retrieve dates < 1970 from a COM:VT_Date variable

for VT_Date < 1970 (year) ,$DOB->Value return -1 ...







Reproduce code:
---------------
$query = new COM("DICOMobjects.DICOMQuery") ;
//settings to Query the Dicom Server"
$query->node="localhost";
$query->port="104";
$query->CallingAE="Client";
$query->CalledAE="Server";
$query->Name="*"; //tell the query to return any patient

$result = $query->DoQuery;//starts the query
$results = $query->Count;//number of items returned

for($i=1;$i<$results+1;$i++) 
{
    $Attrib=$answer->Attributes;
    $DOB = $Attrib->ItemByIndex(4);//Date of birth of the patient
    echo $DOB->value."<br>"; //is a VT_Date an returns a Timestamp
    echo date("d/m/Y",$DOB->value)."<br>"; //formats the timestamp

}

Expected result:
----------------
the returned timestamp should not be -1 for dates < 1970
that makes the date unaccessible , and even for dates>1970 the timestamp should be given from 1901 and not 1970 like it is now

Actual result:
--------------
A timestamp starting from 1901 and not 1970.

Please help me :p

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-09-07 11:33 UTC] sniper@php.net
The com extension has been completely rewritten in PHP5 and the PHP4 com extension is no longer being maintained. If you find bugs with the com extension in PHP5 please report them.

Latest PHP 5 snapshot can be found at http://snaps.php.net/

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 21:01:27 2024 UTC