|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26877 fread() with URL reads only part of file
Submitted: 2004-01-12 04:30 UTC Modified: 2004-01-12 05:28 UTC
From: dinklage at dinklage dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.3.4 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: dinklage at dinklage dot com
New email:
PHP Version: OS:


 [2004-01-12 04:30 UTC] dinklage at dinklage dot com
Using fread() with URL returns only a part of the file:

reading with
25170 Byte is only 2550 Byte

Reproduce code:
$fp = fopen($url,'rb');
$code = fread($fp,4000000);
echo "<p>length ".strlen($code)."  </p>";
echo "<p>length ".strlen($code2)."  </p>";


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-12 05:28 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at


$handle = fopen(\"\", \"rb\");
$contents = \"\";
do {
   $data = fread($handle, 8192);
   if (strlen($data) == 0) {
   $contents .= $data;
} while (true);

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Nov 30 15:01:27 2020 UTC