php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19761 Big numbers add problem
Submitted: 2002-10-04 16:03 UTC Modified: 2002-10-04 19:48 UTC
From: vinicius at teracom dot com dot br Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4CVS-2002-10-04 OS: Linux Redhat 7.3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: vinicius at teracom dot com dot br
New email:
PHP Version: OS:

 

 [2002-10-04 16:03 UTC] vinicius at teracom dot com dot br
Problem find by paulo@teracom.com.br 
When run this script everything goes fine until we reach number 2147483647. In php 4.0.4, it turns the number negative. In latest CVS, it stop add value to the number.

There is the script! To recriate the problem, put the 2147483640 value in stats.txt and refresh the page many times. The number do not pass 2147483648.

Here's the script.

<?
$counter_file = "stats.txt";
$fp = fopen($counter_file, "r");
$counter = (int)fread($fp, 24);
$close = fclose($fp);

if (!isset($hits)) {
   $counter++;
   setcookie("hits","1");
} else {
   $counter++;
   setcookie("hits","$counter");
}
 
$fp = fopen($counter_file , "w");
fwrite($fp, $counter);
fclose($fp);

print "Number: $counter";           
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-04 19:48 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 29 16:01:30 2024 UTC