php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31699 Losing decimals on floats when we recover theirs on a session (locale: fr_FR)
Submitted: 2005-01-26 00:45 UTC Modified: 2005-01-26 19:29 UTC
From: bg at vibros-land dot net Assigned: derick
Status: Closed Package: Variables related
PHP Version: 4.3.10 OS: Linux x86 (Gentoo 2004.3)
Private report: No CVE-ID:
 [2005-01-26 00:45 UTC] bg at vibros-land dot net
Description:
------------
When the locale is set to "fr_FR" or "fr_FR@euro" and when we restore a Float/Double saved on a session, we see the var was truncated by restoring process.

1-Set locale to "fr_FR" or "fr_FR@euro"
2-Start a session
2-Store a Float var in this session
3-End program
4-See the Session File directly : all is good !
5-Restore th session
6-See the var : wrong result !
7-See the Session File directly : all is wrong too !

Reproduce code:
---------------
<?php
setlocale(LC_ALL, "fr_FR@euro", "fr_FR");
session_start();
print("<html><body>\n");
if (isset($_SESSION["float_pos"]) && isset($_SESSION["float_neg"])) {
        printf("Pos Float restored : %01.2f<br/>\n",$_SESSION["float_pos"]);
        printf("Neg Float restored : %01.2f<br/>\n",$_SESSION["float_neg"]);
} else {
        $_SESSION["float_pos"]=0.25;
        $_SESSION["float_neg"]=-9.33;
        printf("Pos Float set to %01.2f<br/>\n",$_SESSION["float_pos"]);
        printf("Neg Float set to %01.2f<br/>\n",$_SESSION["float_neg"]);
}
print("</body></html>\n");
?>


Expected result:
----------------
--- 1st Access ----
Pos Float set to 0,25
Neg Float set to -9,33

--- 2nd Access ----
Pos Float restored : 0,25
Neg Float restored : -9,33

Actual result:
--------------
--- 1st Access ----
Pos Float set to 0,25
Neg Float set to -9,33

--- 2nd Access ----
Pos Float restored : 0,00
Neg Float restored : -9,00

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-26 17:56 UTC] iliaa@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.


 [2005-01-26 19:29 UTC] bg at vibros-land dot net
Thx a lot
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 24 02:02:10 2014 UTC