#19761 [Opn->Bgs]: Big numbers add problem
| From: | iliaa@php.net | Date: | Sat, 05 Oct 2002 00:48:19 +0000 |
| Subject: | #19761 [Opn->Bgs]: Big numbers add problem | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-21534@lists.php.net to get a copy of this message | ||
ID: 19761
Updated by: iliaa@php.net
Reported By: vinicius@teracom.com.br
-Status: Open
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Linux Redhat 7.3
PHP Version: 4CVS-2002-10-04
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2002-10-04 16:03:03] vinicius@teracom.com.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";
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19761&edit=1