From:             florin dot asavoaie at gmail dot com
Operating system: 
PHP version:      5.4.11
Package:          XMLRPC-EPI related
Bug Type:         Bug
Bug description:ISO 8601 not implemented correctly

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 bug report at https://bugs.php.net/bug.php?id=64241&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=64241&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=64241&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=64241&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64241&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64241&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64241&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64241&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64241&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64241&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64241&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=64241&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=64241&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64241&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64241&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64241&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64241&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64241&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64241&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64241&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64241&r=mysqlcfg

Reply via email to