Bug #73793 [NEW]: WDDX uses wrong decimal seperator
| From: | maroszek at gmx dot net | Date: | Tue, 20 Dec 2016 11:59:40 +0000 |
| Subject: | Bug #73793 [NEW]: WDDX uses wrong decimal seperator | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-206152@lists.php.net to get a copy of this message | ||
From: maroszek at gmx dot net
Operating system: Windows
PHP version: 7.1.0
Package: WDDX related
Bug Type: Bug
Bug description:WDDX uses wrong decimal seperator
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
--
Edit bug report at https://bugs.php.net/bug.php?id=73793&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73793&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73793&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73793&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73793&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73793&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73793&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73793&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73793&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73793&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73793&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73793&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73793&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73793&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73793&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73793&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73793&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73793&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73793&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73793&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73793&r=mysqlcfg