|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: niels at monarch dot de
New email:
PHP Version: OS:


 [2005-03-24 16:49 UTC] niels at monarch dot de
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);

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

Expected result:

Actual result:
test:3,14152 (OK)
float(5) (hrmm, not quite!)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-24 18:09 UTC]
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
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Mar 05 04:01:23 2021 UTC