php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32442 serialize/unserialize floats with de-locales
Submitted: 2005-03-24 16:49 UTC Modified: 2005-03-24 18:09 UTC
From: niels at monarch dot de Assigned:
Status: Closed Package: Variables related
PHP Version: 4.3.10 OS: Linux
Private report: No CVE-ID: None
 [2005-03-24 16:49 UTC] niels at monarch dot de
Description:
------------
When unserializing a previously serialized float that contains a exponent-expressed value (ie. 5Mrd), the result is wrong when locale is set to setlocale(LC_ALL,"de_DE");
(with compiled de-locales, of course)

With the locales set to "C", everything works fine.

In my opinion, this is a ',','.'-number-format-handling error.

Reproduce code:
---------------
setlocale (LC_ALL,"de_DE");

echo "test:".(float)3.14152;

$fl1=(float)5000000000; // 5Mrd
$str=serialize ($fl1);
$fl2=unserialize($str);

var_dump ($fl1);
var_dump ($fl2);
phpinfo();


Expected result:
----------------
test:3,14152
float(5.0E+9)
float(5.0E+9)


Actual result:
--------------
test:3,14152 (OK)
float(5.0E+9)
float(5) (hrmm, not quite!)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-24 18:09 UTC] sniper@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 02:01:29 2024 UTC