xref: /PHP-5.5/ext/xmlrpc/tests/bug68027.phpt (revision 44035de7)
1--TEST--
2Bug #68027 (buffer overflow in mkgmtime() function)
3--SKIPIF--
4<?php
5if (!extension_loaded("xmlrpc")) print "skip";
6?>
7--FILE--
8<?php
9
10$d = '6-01-01 20:00:00';
11xmlrpc_set_type($d, 'datetime');
12var_dump($d);
13$datetime = "2001-0-08T21:46:40-0400";
14$obj = xmlrpc_decode("<?xml version=\"1.0\"?><methodResponse><params><param><value><dateTime.iso8601>$datetime</dateTime.iso8601></value></param></params></methodResponse>");
15print_r($obj);
16
17$datetime = "34770-0-08T21:46:40-0400";
18$obj = xmlrpc_decode("<?xml version=\"1.0\"?><methodResponse><params><param><value><dateTime.iso8601>$datetime</dateTime.iso8601></value></param></params></methodResponse>");
19print_r($obj);
20
21echo "Done\n";
22?>
23--EXPECTF--
24object(stdClass)#1 (3) {
25  ["scalar"]=>
26  string(16) "6-01-01 20:00:00"
27  ["xmlrpc_type"]=>
28  string(8) "datetime"
29  ["timestamp"]=>
30  int(%d)
31}
32stdClass Object
33(
34    [scalar] => 2001-0-08T21:46:40-0400
35    [xmlrpc_type] => datetime
36    [timestamp] => %s
37)
38stdClass Object
39(
40    [scalar] => 34770-0-08T21:46:40-0400
41    [xmlrpc_type] => datetime
42    [timestamp] => %d
43)
44Done
45