php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64241 ISO 8601 not implemented correctly
Submitted: 2013-02-18 23:19 UTC Modified: 2013-10-02 06:24 UTC
From: florin dot asavoaie at gmail dot com Assigned:
Status: Not a bug Package: XMLRPC-EPI related
PHP Version: 5.4.11 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
42 + 4 = ?
Subscribe to this entry?

 
 [2013-02-18 23:19 UTC] 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)
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-10-02 06:24 UTC] mike@php.net
-Status: Open +Status: Not a bug
 [2013-10-02 06:24 UTC] mike@php.net
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.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 09:01:27 2024 UTC