xref: /PHP-7.1/ext/xmlrpc/tests/bug40576.phpt (revision 7af945e2)
1--TEST--
2Bug #40576 (double values are truncated to 6 decimal digits when encoding)
3--SKIPIF--
4<?php
5if (!extension_loaded("xmlrpc")) print "skip";
6if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
7?>
8--INI--
9precision=12
10--FILE--
11<?php
12
13var_dump(xmlrpc_encode(1.123456789));
14var_dump(xmlrpc_encode(11234567891010));
15var_dump(xmlrpc_encode(11234567));
16var_dump(xmlrpc_encode(""));
17var_dump(xmlrpc_encode("test"));
18var_dump(xmlrpc_encode("1.22222222222222222222222"));
19
20echo "Done\n";
21?>
22--EXPECTF--
23string(125) "<?xml version="1.0" encoding="utf-8"?>
24<params>
25<param>
26 <value>
27  <double>1.123456789</double>
28 </value>
29</param>
30</params>
31"
32string(130) "<?xml version="1.0" encoding="utf-8"?>
33<params>
34<param>
35 <value>
36  <double>1.1234567891E+13</double>
37 </value>
38</param>
39</params>
40"
41string(116) "<?xml version="1.0" encoding="utf-8"?>
42<params>
43<param>
44 <value>
45  <int>11234567</int>
46 </value>
47</param>
48</params>
49"
50string(106) "<?xml version="1.0" encoding="utf-8"?>
51<params>
52<param>
53 <value>
54  <string/>
55 </value>
56</param>
57</params>
58"
59string(118) "<?xml version="1.0" encoding="utf-8"?>
60<params>
61<param>
62 <value>
63  <string>test</string>
64 </value>
65</param>
66</params>
67"
68string(139) "<?xml version="1.0" encoding="utf-8"?>
69<params>
70<param>
71 <value>
72  <string>1.22222222222222222222222</string>
73 </value>
74</param>
75</params>
76"
77Done
78