php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32138 dateTime decoding: not present
Submitted: 2005-02-28 21:45 UTC Modified: 2005-03-05 13:44 UTC
From: rtroll at yahoo-inc dot com Assigned: dmitry (profile)
Status: Not a bug Package: SOAP related
PHP Version: 5CVS-2005-02-28 OS: *
Private report: No CVE-ID: None
 [2005-02-28 21:45 UTC] rtroll at yahoo-inc dot com
Description:
------------
When using the PHP SOAP client to send over a dateTime object; the client correctly turns a unix timestamp into the appropriate XML dateTime object.

When using the PHP SOAP ext to write a SOAP service; the value is not decoded.

Using the WSDL available via:

  http://ws1.api.re2.yahoo.com/ws/soap-demo/full-php.wsdl

a PHP5 SOAP client will send a request containing a dateTime encoded entity:

  <ns1:dtval>2005-02-28T12:40:51-0800</ns1:dtval>

based on calling the function with a Unix timestamp:

  $client->dateInfo(array( 'dtval' => time() ));



However, a PHP5 SOAP server receiving the request:

  <ns1:dtval>2005-02-28T12:40:51-0800</ns1:dtval>

does not decode the dateTime object into a time_t.  Instead, it passes the raw value to the service method.



Reproduce code:
---------------
<?php
$WSDL = "http://ws1.api.re2.yahoo.com/ws/soap-demo/full-php.wsdl";

function dateInfo( $req )
{
    $dtval = $req->dtval;
    error_log("Returned $dtval", 0);
    return ( array( 'dateString' => "no ctime function",
                    'dateSeconds' => $dtval ));
}

ini_set("soap.wsdl_cache_enabled", "0"); // Disable WSDL caching
$server = new SoapServer( $WSDL );
$server->addFunction("dateInfo");         # 2
$server->handle();
?>


Expected result:
----------------
When using a SOAP client that hits the above script; I would expect the error log to contain:

[...] [error] Returned 1234567890

instead, it's returning:

[...] [error] Returned 2005-02-28T19:22:24Z



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-05 13:44 UTC] dmitry@php.net
ext/soap doesn't convert date types to unix timestamp, because this conversion can lose some data.

At first we can lose timezone, at second dates befor 1970 can't be converted to unix timestamp.

This is the reason.

The conversion from unix timestamp to date types is safe, so it presents.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC