#32138 [Opn->Bgs]: dateTime decoding: not present
| From: | dmitry@php.net | Date: | Sat, 05 Mar 2005 12:44:02 +0000 |
| Subject: | #32138 [Opn->Bgs]: dateTime decoding: not present | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-74872@lists.php.net to get a copy of this message | ||
ID: 32138
Updated by: dmitry@php.net
Reported By: rtroll at yahoo-inc dot com
-Status: Open
+Status: Bogus
Bug Type: SOAP related
Operating System: *
PHP Version: 5CVS-2005-02-28
-Assigned To:
+Assigned To: dmitry
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2005-02-28 21:45:44] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32138&edit=1