php.net |  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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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
message:

    $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
gts@uclink.berkeley.edu

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-07 18:43 UTC] sniper@php.net
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] sniper@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC