#23573 [Opn->Bgs]: fread with large number kills script
| From: | sniper@php.net | Date: | Wed, 14 May 2003 00:44:16 +0000 |
| Subject: | #23573 [Opn->Bgs]: fread with large number kills script | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-39580@lists.php.net to get a copy of this message | ||
ID: 23573
Updated by: sniper@php.net
Reported By: fidian at tiny dot net
-Status: Open
+Status: Bogus
Bug Type: Reproducible crash
Operating System: Linux 2.4.18-586tsc
PHP Version: 4.3.2RC1
New Comment:
Do you really have more that 1Gb memory in your machine?
Just don't do this..
Previous Comments:
------------------------------------------------------------------------
[2003-05-09 22:43:03] fidian at tiny dot net
Running this script causes the server to close the connection. When
doing a similar operation to delete a record at the end of the file,
the server will run the script, delete the record, restart the script,
try to delete a non-existant record (I coded an error message) and then
works the second time but it thinks it couldn't delete the record.
Really weird.
I am using the Debian packaged version of PHP. phpinfo() returns this
information:
Linux cyberhq 2.4.21-pre5 #1 SMP Sat Mar 1 00:30:11 PST 2003 i686
unknown unknown GNU/Linux
Apache/1.3.27 (Unix) Debian GNU/Linux PHP/4.2.3 mod_ssl/2.8.14
OpenSSL/0.9.7a
Build Date Apr 21 2003 01:48:55
If you need the configure line, just email me. I don't think it is
relevant.
Here is my script that I used to finally track down the bug.
<?PHP
// These few lines are for a good hit counter
// to see the problem easier.
// They don't need to be here to show the problem.
// Seed the "hit.txt" file with an initial number
$fp = fopen('hit.txt', 'rb');
$Hit = fgets($fp, 1024);
fclose($fp);
$Hit ++;
echo "Hit: $Hit<br>\n";
$fp = fopen('hit.txt', 'wb');
fputs($fp, $Hit);
fclose($fp);
// The problem.
$fp = fopen('php_bug.txt', "w+");
// Uncomment this to kill the process.
//fread($fp, 1080648704);
echo "Done.";
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23573&edit=1