Today was a fun day. Apparently if permissions are not set up properly on the files you upload to the "downloads" directly then ubercart starts an endless loop of feof, fopen, fread errors that are all being posted to the watchdog table.
Once the permissions are fixed you don't have an issue but the errors still post. Anyway, i recommend making a minor change to the uc_file.pages.inc around line 322ish in ubercart 2.3
CURRENT CODE:
// Open the file and seek to starting byte
$fp = fopen($file_user->full_path, 'rb');
fseek($fp, $seek_start);
// Start buffered download
while (!feof($fp)) {
// Reset time limit for large files
set_time_limit(0);
// Push the data to the client.
print(fread($fp, UC_FILE_BYTE_SIZE));
flush();
ob_flush();
}
// Finished serving the file, close the stream and log the download to the user table
fclose($fp);
NEW CODE:
// Open the file and seek to starting byte
if($fp = fopen($file_user->full_path, 'rb')) {
fseek($fp, $seek_start);
// Start buffered download
while (!feof($fp)) {
// Reset time limit for large files
set_time_limit(0);
// Push the data to the client.
print(fread($fp, UC_FILE_BYTE_SIZE));
flush();
ob_flush();
}
// Finished serving the file, close the stream and log the download to the user table
fclose($fp);
}
a minor change but at least it checks to make sure the file can be opened before the loop starts
Comments
Comment #1
longwaveMarked #999570: _uc_file_download_transfer() should perform error checking as duplicate
Comment #2
tr commentedBumping up to current version of Ubercart for consideration.
Anyone want to write a patch for this?
Comment #3
longwaveThis function should probably be rewritten based on file_transfer() in core: http://api.drupal.org/api/drupal/includes!file.inc/function/file_transfer/6
Comment #4
longwaveFixed in both branches by simply changing is_file() to is_readable() in _uc_file_download_validate().