php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73793 WDDX uses wrong decimal seperator
Submitted: 2016-12-20 11:59 UTC Modified: -
From: maroszek at gmx dot net Assigned:
Status: Closed Package: WDDX related
PHP Version: 7.1.0 OS: Windows
Private report: No CVE-ID:
 [2016-12-20 11:59 UTC] maroszek at gmx dot net
Description:
------------
WDDX does locale aware conversion from double to string. Unfortunately it does not support locale aware conversion back to double. Anyways: I would suggest to disable locale aware conversion and always use a point (.) as decimal seperator.

Test script:
---------------
setlocale(LC_ALL , "German");
$x = Array("XYZ"=>5.1);
$y = wddx_serialize_value($x);
var_dump($y);
$z = wddx_deserialize($y);
var_dump($z);
echo ($x == $z) ? "OK" : "FAIL"; 

Expected result:
----------------
string(120) "<wddxPacket version='1.0'><header/><data><struct><var name='XYZ'><number>5.1</number></var></struct></data></wddxPacket>"
array(1) {
  ["XYZ"]=>
  float(5.1)
}
OK

Actual result:
--------------
string(120) "<wddxPacket version='1.0'><header/><data><struct><var name='XYZ'><number>5,1</number></var></struct></data></wddxPacket>"
array(1) {
  ["XYZ"]=>
  int(5)
}
FAIL

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-08-13 19:15 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f64be0b0135f742df31bc97dd3c04f84f342878e
Log: Fixed bug #73793 (WDDX uses wrong decimal seperator)
 [2017-08-13 19:15 UTC] cmb@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Aug 29 15:01:52 2017 UTC