ID: 32115 Updated by: [EMAIL PROTECTED] Reported By: rtroll at yahoo-inc dot com -Status: Assigned +Status: Closed Bug Type: SOAP related Operating System: * PHP Version: 5CVS-2005-02-25 Assigned To: dmitry New Comment:
Fixed in CVS (HEAD and PHP_5_0). Previous Comments: ------------------------------------------------------------------------ [2005-02-25 22:22:27] rtroll at yahoo-inc dot com Description: ------------ It looks like PHP's encoding of a dateTime value is incorrectly encoding the timezone. For example, encoding unix time: 1109366152 results in 2005-02-25T13:15:52-0800 instead of: 2005-02-25T13:15:52-08:00 The timezone offset must contain a colon, according to http://www.w3.org/TR/xmlschema-2/ Section 3.2.7.3: Timezones Reproduce code: --------------- <?php $WSDL = "http://ws1.api.re2.yahoo.com/ws/soap-demo/full.wsdl"; $client = new SoapClient( $WSDL, array( "trace" => true, "exceptions" => 0, )); function dump_xml( $title, $body ) { $nl = preg_replace( "/\>\</", ">\n<", $body ); $clean = htmlspecialchars( $nl ); print "\n<b>$title</b>\n<pre>$clean</pre>\n"; } $t = time(); $r = $client->dateInfo( array( 'dtval' => $t ) ); $dateTime_pst = strftime( "%Y-%m-%dT%H:%M:%S-08:00", time() ); # Works 'cause server is in PST zone $dateTime_utc = gmstrftime( "%Y-%m-%dT%H:%M:%SZ", time() ); echo "<h2>Bug</h2>Request should have converted unix timestamp [$t] to xs:dateTime string [$dateTime_utc] or [$dateTime_pst]. Instead, request is:<br>\n"; dump_xml( "Request", $client->__getLastRequest() ); Expected result: ---------------- Request should be similiar to: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:yahoo:platform:soap:demo:full"> <SOAP-ENV:Body> <ns1:dateInfo> <ns1:dtval>2005-02-25T13:19:10-08:00</ns1:dtval> </ns1:dateInfo> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Actual result: -------------- Request is currently: <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:yahoo:platform:soap:demo:full"> <SOAP-ENV:Body> <ns1:dateInfo> <ns1:dtval>2005-02-25T13:19:10-0800</ns1:dtval> </ns1:dateInfo> </SOAP-ENV:Body> </SOAP-ENV:Envelope> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32115&edit=1