ID: 44996 Comment by: kawai at apache dot org Reported By: helixpip at gmail dot com Status: Open Bug Type: XMLRPC-EPI related Operating System: Windows 2000 PHP Version: 5.2.6 New Comment:
Now, you can download patched version of xmlrpc extension from: http://mp.i-revo.jp/user.php/kcvcrlkq/entry/313.html I hope this patch to be applied in the next PHP release. Previous Comments: ------------------------------------------------------------------------ [2008-05-14 18:14:24] helixpip at gmail dot com I wrote: >Ideally the scalar property should explicitly be >a UTC ISO 8601 datetime value, ending with the >time zone designator 'Z'. On second thought, it might be more useful for a php script to know what, if any, time zone designator appeared with the original iso8601 datetime value. (At the moment there's no way to find this information without parsing the xml.) If the scalar property preserved the original time zone designator, that would help with this. ------------------------------------------------------------------------ [2008-05-14 17:47:07] helixpip at gmail dot com Description: ------------ The xmlrpc_decode function does not correctly interpret ISO 8601 timezone designations when interpreting XML-RPC datetime values passed in <dateTime.iso8601> tags. It appears that the time zone designator is completely ignored and the local time zone is assumed. (The xmlrpc_decode_request function shows the same behavior.) A side effect of this bug is that the 'scalar' and 'timestamp' objects returned for XML-RPC datetime values will disagree if the object is used is used in a different time zone than it was created. Ideally the scalar property should explicitly be a UTC ISO 8601 datetime value, ending with the time zone designator 'Z'. Reproduce code: --------------- function DecodeDatetime($datetime) { print "\nISO 8601 datetime $datetime\n"; print "strtotime yields " . strtotime($datetime) . "\nxmlrpc_decode yields "; $obj = xmlrpc_decode("<?xml version=\"1.0\"?><methodResponse><params><param><value><dateTime.iso8601>$datetime</dateTime.iso8601></value></param></params></methodResponse>"); print_r($obj); } DecodeDatetime("20010909T01:46:40Z"); DecodeDatetime("20010909T00:46:40-01"); DecodeDatetime("2001-09-09T08:46:40+07:00"); DecodeDatetime("2001-09-08T21:46:40-0400"); Expected result: ---------------- The ISO 8601 datetime strings tested above are all valid and equivalent They all represent the same timestamp as the unix time 1000000000, and strtotime() function converts them all correctly. I would expect that the object returned by xml_rpc decode should, in all four test cases, have the timestamp property = 1000000000 and have the scalar property as a string that would convert to 1000000000 if fed to strtotime(). Actual result: -------------- The xmlrpc_decode function gets them all wrong except for the last one, which happens to have the same time zone as my test system: ISO 8601 datetime 20010909T01:46:40Z strtotime yields 1000000000 xmlrpc_decode yields stdClass Object ( [scalar] => 20010909T01:46:40 [xmlrpc_type] => datetime [timestamp] => 1000014400 ) ISO 8601 datetime 20010909T00:46:40-01 strtotime yields 1000000000 xmlrpc_decode yields stdClass Object ( [scalar] => 20010909T00:46:40 [xmlrpc_type] => datetime [timestamp] => 1000010800 ) ISO 8601 datetime 2001-09-09T08:46:40+07:00 strtotime yields 1000000000 xmlrpc_decode yields stdClass Object ( [scalar] => 20010909T08:46:40 [xmlrpc_type] => datetime [timestamp] => 1000039600 ) ISO 8601 datetime 2001-09-08T21:46:40-0400 strtotime yields 1000000000 xmlrpc_decode yields stdClass Object ( [scalar] => 20010908T21:46:40 [xmlrpc_type] => datetime [timestamp] => 1000000000 ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44996&edit=1