#19050 [NEW]: Problems with fgets useing large buffers (about 65530)
| From: | darklord at revai dot hu | Date: | Thu, 22 Aug 2002 15:37:16 +0000 |
| Subject: | #19050 [NEW]: Problems with fgets useing large buffers (about 65530) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-17555@lists.php.net to get a copy of this message | ||
From: darklord@revai.hu
Operating system: Linux Debian Woody
PHP version: 4.1.2
PHP Bug Type: Filesystem function related
Bug description: Problems with fgets useing large buffers (about 65530)
here's a part of the code I planned to use (it's a method of an object):
function host_get($file) {
$tmpname=tempnam("/tmp","IWO".uniqid(rand()));
if (!ftp_get($this->ftp_fd,$tmpname,$file,FTP_BINARY)) {
die("Can't download from server");
}
$fd=fopen($tmpname,"r");
$a=array();
while (!feof($fd)) {
$m=fgets($fd,65536);
$a[]=$m;
}
fclose($fd);
unlink($tmpname);
return $a;
}
But sometimes (when 3 times this function was called ) the PHP interpreter
hanged. (I can't reproduce this problem w/o my whole src), but when I
changed the line
$m=fgets($fd,65000);
to
$m=fgets($fd,3000);
The script started to work again ...
I use debian woody with the original apache and php packages, postgres and
ftp modules in this script.
--
Edit bug report at http://bugs.php.net/?id=19050&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=19050&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=19050&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=19050&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=19050&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=19050&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=19050&r=support
Expected behavior: http://bugs.php.net/fix.php?id=19050&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=19050&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=19050&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=19050&r=globals