mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-09-05 07:16:27 +00:00
Merge pull request #453 from zachborboa/fix-430
Fix #430: Close open file handle before renaming file affecting Windows
This commit is contained in:
@@ -12,6 +12,7 @@ php:
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: hhvm
|
||||
- php: nightly
|
||||
|
||||
before_script:
|
||||
|
||||
+6
-1
@@ -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);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user