Home » Web Services » SOAP » Bug #10206
Timezone in Type/dateTime.php not converted correctly
Details
| Submitted | 2007-02-27 13:01 UTC |
|---|---|
| From | jan dot ehrlich at uni-passau dot de |
| Assigned | cweiske |
| Status | Closed |
| Package | SOAP |
| PHP Version | 4.4.4 |
| OS | Windows |
| Roadmaps | (Not assigned) |
Comments
[2007-02-27 13:01 UTC] jan dot ehrlich at uni-passau dot de
Description:
------------
On line 97 in the function toString the timezone is converted with the default PHP convert string O . This is false.
The PHP use for timezone the pattern +0200 , but the XSD
defines the pattern +02:00 (see http://www.w3.org/TR/xmlschema-2/#dateTime-timezones).
The source code should be modified to be XSD compatible.
Test script:
---------------
You should add following function:
/**
* Converts PHP timezone String to XSD compatible timezone String.
* see http://www.w3.org/TR/xmlschema-2/#dateTime-timezones
* @param string $timeZoneStr a PHP timezone string
* @return string An XSD compatible timezone string
*/
function timeZoneToXSD($timeZoneStr)
{
if(strlen($timeZoneStr)!=5)
{
return $timeZoneStr;
}
return substr($timeZoneStr,0,3) . ":" . substr($timeZoneStr,3,2);
}
and substitute the line 97 with following:
return date('Y-m-d\TH:i:s', $timestamp) . $this->timeZoneToXSD(date('O', $timestamp)) ;