|  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
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:

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


based on calling the function with a Unix timestamp:

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

However, a PHP5 SOAP server receiving the request:


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

Reproduce code:
$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

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-05 13:44 UTC]
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-2023 The PHP Group
All rights reserved.
Last updated: Thu Mar 30 01:03:40 2023 UTC