#31699 [Asn->Csd]: Losing decimals on floats when we recover theirs on a session (locale: fr_FR)
| From: | iliaa@php.net | Date: | Wed, 26 Jan 2005 16:56:23 +0000 |
| Subject: | #31699 [Asn->Csd]: Losing decimals on floats when we recover theirs on a session (locale: fr_FR) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-72877@lists.php.net to get a copy of this message | ||
ID: 31699
Updated by: iliaa@php.net
Reported By: bg at vibros-land dot net
-Status: Assigned
+Status: Closed
Bug Type: Variables related
Operating System: Linux x86 (Gentoo 2004.3)
PHP Version: 4.3.10
Assigned To: derick
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2005-01-26 01:03:49] iliaa@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[2005-01-26 00:45:40] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31699&edit=1