php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23573 fread with large number kills script
Submitted: 2003-05-09 22:43 UTC Modified: 2003-05-13 19:44 UTC
From: fidian at tiny dot net Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 4.3.2RC1 OS: Linux 2.4.18-586tsc
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: fidian at tiny dot net
New email:
PHP Version: OS:

 

 [2003-05-09 22:43 UTC] 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.";

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-13 19:44 UTC] sniper@php.net
Do you really have more that 1Gb memory in your machine?
Just don't do this..

 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Oct 07 05:00:01 2026 UTC