xref: /PHP-7.2/ext/xmlrpc/tests/bug45226.phpt (revision f38bfa62)
1--TEST--
2Bug #45226 (xmlrpc_set_type() segfaults with valid ISO8601 date string)
3--INI--
4date.timezone="America/Sao_Paulo"
5--SKIPIF--
6<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
7--FILE--
8<?php
9
10$d = date(DATE_ISO8601);
11xmlrpc_set_type($d, 'datetime');
12echo xmlrpc_encode_request('method.call', array('date' => $d));
13
14$d = '2008-01-01 20:00:00';
15xmlrpc_set_type($d, 'datetime');
16echo xmlrpc_encode_request('method.call', array('date' => $d));
17
18?>
19--EXPECTF--
20<?xml version="1.0" encoding="iso-8859-1"?>
21<methodCall>
22<methodName>method.call</methodName>
23<params>
24 <param>
25  <value>
26   <struct>
27    <member>
28     <name>date</name>
29     <value>
30      <dateTime.iso8601>%d-%d-%dT%d:%d:%d%s%d</dateTime.iso8601>
31     </value>
32    </member>
33   </struct>
34  </value>
35 </param>
36</params>
37</methodCall>
38<?xml version="1.0" encoding="iso-8859-1"?>
39<methodCall>
40<methodName>method.call</methodName>
41<params>
42 <param>
43  <value>
44   <struct>
45    <member>
46     <name>date</name>
47     <value>
48      <dateTime.iso8601>%d-%d-%d %d:%d:%d</dateTime.iso8601>
49     </value>
50    </member>
51   </struct>
52  </value>
53 </param>
54</params>
55</methodCall>
56