Merge pull request #453 from zachborboa/fix-430

Fix #430: Close open file handle before renaming file affecting Windows
This commit is contained in:
Zach Borboa
2017-06-27 02:23:06 -07:00
committed by GitHub
2 changed files with 7 additions and 1 deletions
+1
View File
@@ -12,6 +12,7 @@ php:
matrix:
allow_failures:
- php: hhvm
- php: nightly
before_script:
+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);
};
}