01199: HandleDownload can truncate files, needs to flush before exit

Summary: HandleDownload can truncate files, needs to flush before exit
Created: 2010-05-27 04:47
Status: Closed - fixed for 2.2.17
Category: Bug
From: Maxim?
Assigned:
Priority: 5
Version: 2.2.16
OS: Linux/Apache 2.0.63/PHP 5.2.8

Description: A certain files was getting truncated on download. I amended HandleDownload() to flush():

  if ($fp) {
    while (!feof($fp)) echo fread($fp, 4096);
    flush();
    fclose($fp);
  }

and it fixed it.

  • File was confirmed as OK on the server
  • File was 59812 bytes, but was truncated to 59792 (but exact details may vary by server)
  • Happened the same with different browsers

Thanks, added for 2.2.17. --Petko May 27, 2010, at 03:30 PM