xref: /PHP-5.4/ext/xmlrpc/tests/bug44996.phpt (revision f38bfa62)
1--TEST--
2Bug #44996 (xmlrpc_decode() ignores time zone on iso8601.datetime)
3--SKIPIF--
4<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
5--FILE--
6<?php
7
8function DecodeDatetime($datetime) {
9  print "\nISO 8601 datetime $datetime\n";
10  $obj = xmlrpc_decode("<?xml version=\"1.0\"?><methodResponse><params><param><value><dateTime.iso8601>$datetime</dateTime.iso8601></value></param></params></methodResponse>");
11  print_r($obj);
12}
13
14DecodeDatetime("20010909T01:46:40Z");
15DecodeDatetime("20010909T00:46:40-01");
16DecodeDatetime("2001-09-09T08:46:40+07:00");
17DecodeDatetime("2001-09-08T21:46:40-0400");
18
19?>
20--EXPECT--
21ISO 8601 datetime 20010909T01:46:40Z
22stdClass Object
23(
24    [scalar] => 20010909T01:46:40Z
25    [xmlrpc_type] => datetime
26    [timestamp] => 1000000000
27)
28
29ISO 8601 datetime 20010909T00:46:40-01
30stdClass Object
31(
32    [scalar] => 20010909T00:46:40-01
33    [xmlrpc_type] => datetime
34    [timestamp] => 1000000000
35)
36
37ISO 8601 datetime 2001-09-09T08:46:40+07:00
38stdClass Object
39(
40    [scalar] => 2001-09-09T08:46:40+07:00
41    [xmlrpc_type] => datetime
42    [timestamp] => 1000000000
43)
44
45ISO 8601 datetime 2001-09-08T21:46:40-0400
46stdClass Object
47(
48    [scalar] => 2001-09-08T21:46:40-0400
49    [xmlrpc_type] => datetime
50    [timestamp] => 1000000000
51)
52