#36397 [Opn->Bgs]: decimal values stored in session variables not reliable

From: Date: Wed, 15 Feb 2006 07:30:33 +0000
Subject: #36397 [Opn->Bgs]: decimal values stored in session variables not reliable
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-93277@lists.php.net to get a copy of this message
ID: 36397 Updated by: tony2001@php.net Reported By: simonb at velocityweb dot com dot au -Status: Open +Status: Bogus Bug Type: Session related Operating System: netware PHP Version: 5.1.2 New Comment: Works just fine. Previous Comments: ------------------------------------------------------------------------ [2006-02-15 06:03:05] simonb at velocityweb dot com dot au 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 this bug report at http://bugs.php.net/?id=36397&edit=1

« previous php.bugs (#93277) next »