#19050 [Com]: Problems with fgets useing large buffers (about 65530)

From: Date: Mon, 26 Aug 2002 08:02:55 +0000
Subject: #19050 [Com]: Problems with fgets useing large buffers (about 65530)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-17828@lists.php.net to get a copy of this message
ID: 19050 Comment by: darklord@revai.hu Reported By: darklord@revai.hu Status: Feedback Bug Type: Filesystem function related Operating System: Linux Debian Woody PHP Version: 4.1.2 New Comment: The -d 3 doesn't solve the problem with ftp_rawlist, but the following code works for it: $i=0; while (($a=ftp_rawlist($this->ftp_fd,$dir)) === false) { $i++; if ($i > 5) { die("Error"); } } Previous Comments: ------------------------------------------------------------------------ [2002-08-26 03:33:35] darklord@revai.hu #13400 is a workaround for this bug, but I think proftp dev team should know about this thing ... ------------------------------------------------------------------------ [2002-08-26 03:28:38] darklord@revai.hu I think this error is specific to proftpd becouse the script works fine on a wu-ftpd ... ------------------------------------------------------------------------ [2002-08-26 02:13:07] darklord@revai.hu Hi! I've tryed php 4.2.2 (php-cvs don't compile, the error is in the mysql lib). Ok! The script above now prints the following (I've chaged the ftp timeout to 1 sec): Warning: ftp_get: in /home_real/darklord/devel/iwo/modules/host_access/ftp/base.php on line 144 I use proftpd and this bug is like #18781, but they say the functions are slow, but in my case the functions are hanging. I use a local server (my computer) so the transfer should be fast. (Sorry for the prev bug report ... but changing the buffer size solved the problem ... temporaly) ------------------------------------------------------------------------ [2002-08-23 21:19:04] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php4-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-latest.zip ------------------------------------------------------------------------ [2002-08-22 11:37:15] darklord@revai.hu 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 this bug report at http://bugs.php.net/?id=19050&edit=1

« previous php.bugs (#17828) next »