Bug #3515: fread() just read a few bytes
| From: | bjarne dot ingelsson at enator dot se | Date: | Thu, 17 Feb 2000 08:15:02 +0000 |
| Subject: | Bug #3515: fread() just read a few bytes | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-15628@lists.php.net to get a copy of this message | ||
From: bjarne.ingelsson@enator.se
Operating system: WinNT4 SP6
PHP version: 3.0.14
PHP Bug Type: Misbehaving function
Bug description: fread() just read a few bytes
// PHP4b3 problem!
// This version is not available in the dropdown...
fread() doesn't return the correct number of bytes in Win32 environment.
For some reason it just reads the first 33 bytes (in my example, depends on the file to be read).
$sourcefile = "./aniclick.gif";
$fd = fopen($sourcefile, "r");
$contents = fread($fd, filesize($sourcefile));
$encoded = chunk_split(base64_encode($contents));
fclose($fd);
echo "FileSize: ". filesize($sourcefile)."<BR>
Read: ".strlen($contents). "<BR>
Encoded: ".strlen($encoded). "<BR>
Ratio: ". number_format((strlen($encoded) / strlen($contents)), 2). "<BR>";
The code above give the following result:
FileSize: 19910
Read: 33
Encoded: 46
Ratio: 1.39
/Bjarne