|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23011 fpassthru changed?
Submitted: 2003-04-01 21:57 UTC Modified: 2003-04-08 20:06 UTC
From: gts at uclink dot berkeley dot edu Assigned:
Status: No Feedback Package: Filesystem function related
PHP Version: 4.3.1 OS: SunOS 5.7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: gts at uclink dot berkeley dot edu
New email:
PHP Version: OS:


 [2003-04-01 21:57 UTC] gts at uclink dot berkeley dot edu
Have been using the following code for downloads with PHP
4.2.2 and Apache/1.3.26.  Fpassthru() did not return on an
aborted download (user selects cancel).  Now with PHP 4.3.1
and Apache 2, aborted downloads return and give the OK

    $fp = @fopen( "$file", 'r' );
    $rc = fpassthru($fp);
    Log("($file) ($rc) Download OK.");

The value returned by fpassthru($fp) is always the full size
of the file even when the download is aborted (even on very
large files where there is no chance it could actually have
beem read, 250MB).  When tested with ===, fpassthru($fp)
always returns FALSE.  Same results with readfile().

What's happening here?

Greg Small


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-07 18:43 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

 [2003-04-08 12:29 UTC] gts at uclink dot berkeley dot edu
Have not had time to try the snapshot and staff member
going on vacation.  Will revisit next month.  Workaround
in place.
 [2003-04-08 20:06 UTC]
reopen when you really give the feedback, until that, leave as 'No feedback'. Thank you.

 [2005-05-11 04:59 UTC] tjerk dot meesters at gmail dot com
In addition: according to the documentation, fpassthru() should return either false, or the number of bytes read and transferred.

However, if a visitor cancels the download (and ignore_user_abort = true), fpassthru() will return the full size of the file instead of the actual bytes transferred.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Oct 25 23:01:24 2020 UTC