File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / xmlrpc / tests / bug40576.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:05 2012 UTC (12 years, 8 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--TEST--
Bug #40576 (double values are truncated to 6 decimal digits when encoding)
--SKIPIF--
<?php
if (!extension_loaded("xmlrpc")) print "skip";
if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
?>
--INI--
precision=12
--FILE--
<?php

var_dump(xmlrpc_encode(1.123456789));
var_dump(xmlrpc_encode(11234567891010));
var_dump(xmlrpc_encode(11234567));
var_dump(xmlrpc_encode(""));
var_dump(xmlrpc_encode("test"));
var_dump(xmlrpc_encode("1.22222222222222222222222"));

echo "Done\n";
?>
--EXPECTF--	
string(125) "<?xml version="1.0" encoding="utf-8"?>
<params>
<param>
 <value>
  <double>1.123456789</double>
 </value>
</param>
</params>
"
string(130) "<?xml version="1.0" encoding="utf-8"?>
<params>
<param>
 <value>
  <double>1.1234567891E+13</double>
 </value>
</param>
</params>
"
string(116) "<?xml version="1.0" encoding="utf-8"?>
<params>
<param>
 <value>
  <int>11234567</int>
 </value>
</param>
</params>
"
string(106) "<?xml version="1.0" encoding="utf-8"?>
<params>
<param>
 <value>
  <string/>
 </value>
</param>
</params>
"
string(118) "<?xml version="1.0" encoding="utf-8"?>
<params>
<param>
 <value>
  <string>test</string>
 </value>
</param>
</params>
"
string(139) "<?xml version="1.0" encoding="utf-8"?>
<params>
<param>
 <value>
  <string>1.22222222222222222222222</string>
 </value>
</param>
</params>
"
Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>