PHP 4.0 Bug #9024: fread can't read whole file

From: Date: Wed, 31 Jan 2001 10:19:44 +0000
Subject: PHP 4.0 Bug #9024: fread can't read whole file
Groups: php.dev 
Request: Send a blank email to php-dev+get-45440@lists.php.net to get a copy of this message
From: zionglau@yahoo.com Operating system: WinNT 4.0 PHP version: 4.0.4pl1 PHP Bug Type: Filesystem function related Bug description: fread can't read whole file i'm using the following code to read and output a file: $fp = fopen("a_file_here", "r"); // retreive the file content while (!feof($fp)){ set_time_limit(5); // retreive the file content $contents = fread($fp, 1024); // output the content echo ($contents); flush(); } These codes is work fine in older version(php3), but now it cannot read the file completly. For example the file have 1024 byte, it only can read the first 300 byte. Also it work fine with the TEXT file. This problem only happen when i try to read a binary file(e.g. gif/jepg). it seem to be stop reading when the file have a eof char data but it is not really End Of File. Moreover, i'm using Apache and running module mode, but it will work fine when running cgi mode. -- Edit Bug report at: http://bugs.php.net/?id=9024&edit=1

« previous php.dev (#45440) next »