Edit report at https://bugs.php.net/bug.php?id=64241&edit=1
ID: 64241 Updated by: m...@php.net Reported by: florin dot asavoaie at gmail dot com Summary: ISO 8601 not implemented correctly -Status: Open +Status: Not a bug Type: Bug Package: XMLRPC-EPI related PHP Version: 5.4.11 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php >From the XMLRPC spec (Update 1/21/99) http://xmlrpc.scripting.com/spec#update3 > What timezone should be assumed for the > dateTime.iso8601 type? UTC? localtime? > Don't assume a timezone. It should be > specified by the server in its > documentation what assumptions it makes > about timezones. Previous Comments: ------------------------------------------------------------------------ [2013-02-18 23:19:16] florin dot asavoaie at gmail dot com Description: ------------ ISO 8601 states the following: "If no UTC relation information is given with a time representation, the time is assumed to be in local time.". xmlrpc_decode and xmlrpc_decode_request functions do not conform with this standard because, when they decode the time that is formatted in ISO 8601 format and no timezone information is present, the time always gets converted to UTC, when it should actually be considered local time. Test script: --------------- <?php $xml1 = '<value><dateTime.iso8601>20120810T12:03:12</dateTime.iso8601></value>'; $xml2 = '<value><dateTime.iso8601>20120810T12:03:12+02:00</dateTime.iso8601></value>'; $xml3 = '<value><dateTime.iso8601>20120810T12:03:12Z</dateTime.iso8601></value>'; echo date ('c', time ()) . PHP_EOL; $date1 = xmlrpc_decode ($xml1); $date2 = xmlrpc_decode ($xml2); $date3 = xmlrpc_decode ($xml3); var_dump ($date1, $date2, $date3); Expected result: ---------------- 2013-02-19T01:04:17+02:00 object(stdClass)#1 (3) { ["scalar"]=> string(17) "20120810T12:03:12" ["xmlrpc_type"]=> string(8) "datetime" ["timestamp"]=> int(1344592992) } object(stdClass)#2 (3) { ["scalar"]=> string(23) "20120810T12:03:12+02:00" ["xmlrpc_type"]=> string(8) "datetime" ["timestamp"]=> int(1344592992) } object(stdClass)#3 (3) { ["scalar"]=> string(18) "20120810T12:03:12Z" ["xmlrpc_type"]=> string(8) "datetime" ["timestamp"]=> int(1344600192) } Actual result: -------------- 2013-02-19T01:04:17+02:00 object(stdClass)#1 (3) { ["scalar"]=> string(17) "20120810T12:03:12" ["xmlrpc_type"]=> string(8) "datetime" ["timestamp"]=> int(1344600192) } object(stdClass)#2 (3) { ["scalar"]=> string(23) "20120810T12:03:12+02:00" ["xmlrpc_type"]=> string(8) "datetime" ["timestamp"]=> int(1344592992) } object(stdClass)#3 (3) { ["scalar"]=> string(18) "20120810T12:03:12Z" ["xmlrpc_type"]=> string(8) "datetime" ["timestamp"]=> int(1344600192) } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=64241&edit=1