php-src/ext/wddx/tests/bug73793.phpt
Christoph M. Becker f64be0b013 Fixed bug #73793 (WDDX uses wrong decimal seperator)
The WDDX specification[1] requires to serialize floats with a decimal
point, but `snprintf()` is locale-dependent and may use a decimal
comma. We fix that afterwards by replacing an eventual comma with a
point.

[1] <http://xml.coverpages.org/wddx0090-dtd-19980928.txt>
2017-08-13 20:51:53 +02:00

19 lines
565 B
PHP

--TEST--
Bug #73793 (WDDX uses wrong decimal seperator)
--SKIPIF--
<?php
if (!extension_loaded('wddx')) print 'skip wddx extension not available';
if (setlocale(LC_NUMERIC, ['de_DE', 'de_DE.UTF-8', 'de-DE']) === false) {
print 'skip German locale not available';
}
?>
--FILE--
<?php
setlocale(LC_NUMERIC , ['de_DE', 'de_DE.UTF-8', 'de-DE']);
var_dump(wddx_serialize_value(['foo' => 5.1]));
?>
===DONE===
--EXPECT--
string(120) "<wddxPacket version='1.0'><header/><data><struct><var name='foo'><number>5.1</number></var></struct></data></wddxPacket>"
===DONE===