#32115 [NEW]: dateTime encoding of timezone incorrect
From: rtroll at yahoo-inc dot com
Operating system:
PHP version: 5CVS-2005-02-25 (dev)
PHP Bug Type: SOAP related
Bug description: dateTime encoding of timezone incorrect
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 bug report at http://bugs.php.net/?id=32115&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32115&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32115&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32115&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32115&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32115&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32115&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32115&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32115&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32115&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32115&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32115&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32115&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32115&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32115&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32115&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32115&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32115&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32115&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32115&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32115&r=mysqlcfg
Thread (3 messages)
- rtroll at yahoo-inc dot com