|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-10-02 06:24 UTC] mike@php.net
-Status: Open
+Status: Not a bug
[2013-10-02 06:24 UTC] mike@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 13:00:01 2025 UTC |
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) }