#36397 [NEW]: decimal values stored in session variables not reliable

From: Date: Wed, 15 Feb 2006 05:03:06 +0000
Subject: #36397 [NEW]: decimal values stored in session variables not reliable
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-93272@lists.php.net to get a copy of this message
From: simonb at velocityweb dot com dot au Operating system: netware PHP version: 5.1.2 PHP Bug Type: Session related Bug description: decimal values stored in session variables not reliable Description: ------------ trying to save a decimal number in a session value Run badsave.php to store a value. Seems to recall it ok within that scripts. Running badrecall.php retrieves some other number. the test number here 127.27 returns 72.035156309605 most other numbers ok, in quotes its ok. Reproduce code: --------------- <? /*badsave.php*/ session_start(); $n=127.27; store($n); recall(); function store($n=0){ echo "saving $n"; $_SESSION["badno"]=$n; } function recall(){ session_start(); $n=$_SESSION["badno"]; echo "<br>recall $n"; } ?> <? /*badrecall.php*/ session_start(); $n=$_SESSION["badno"]; echo "<br>recall $n"; ?> Expected result: ---------------- just echo 127.27 to the screen Actual result: -------------- echo returned 72.035156309605 instead. -- Edit bug report at http://bugs.php.net/?id=36397&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36397&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36397&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36397&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36397&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36397&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36397&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36397&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36397&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36397&r=support Expected behavior: http://bugs.php.net/fix.php?id=36397&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36397&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36397&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36397&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36397&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36397&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36397&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36397&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36397&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36397&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36397&r=mysqlcfg

« previous php.bugs (#93272) next »