From: bg at vibros-land dot net
Operating system: Linux x86 (Gentoo 2004.3)
PHP version: 4.3.10
PHP Bug Type: Variables related
Bug description: Losing decimals on floats when we recover theirs on a session
(locale: fr_FR)
Description:
------------
When the locale is set to "fr_FR" or "[EMAIL PROTECTED]" 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 "[EMAIL PROTECTED]"
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, "[EMAIL PROTECTED]", "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 bug report at http://bugs.php.net/?id=31699&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=31699&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=31699&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=31699&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=31699&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=31699&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=31699&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=31699&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=31699&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=31699&r=support
Expected behavior: http://bugs.php.net/fix.php?id=31699&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=31699&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=31699&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=31699&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=31699&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=31699&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=31699&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=31699&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=31699&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=31699&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=31699&r=mysqlcfg