php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36397 decimal values stored in session variables not reliable
Submitted: 2006-02-15 06:03 UTC Modified: 2006-02-15 08:30 UTC
From: simonb at velocityweb dot com dot au Assigned:
Status: Not a bug Package: Session related
PHP Version: 5.1.2 OS: netware
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: simonb at velocityweb dot com dot au
New email:
PHP Version: OS:

 

 [2006-02-15 06:03 UTC] 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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-02-15 08:30 UTC] tony2001@php.net
Works just fine.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Aug 28 08:00:02 2025 UTC