Fix #430: Close open file handle before renaming file affecting Windows

This commit is contained in:
Zach Borboa
2017-06-27 01:59:26 -07:00
parent 3b672a2131
commit b4d20d0f28
+6 -1
View File
@@ -298,7 +298,12 @@ class Curl
$this->fileHandle = fopen($download_filename, $mode);
// Move the downloaded temporary file to the destination save path.
$this->downloadCompleteFunction = function ($fh) use ($download_filename, $filename) {
$this->downloadCompleteFunction = function ($instance, $fh) use ($download_filename, $filename) {
// Close the open file handle before renaming the file.
if (is_resource($fh)) {
fclose($fh);
}
rename($download_filename, $filename);
};
}