Fix curl file handle not being correctly unset; Clean up

This commit is contained in:
Zach Borboa
2015-04-01 09:58:14 -07:00
parent 512b514ef2
commit d279e4b598
+10 -3
View File
@@ -281,17 +281,24 @@ class MultiCurl
// Close open file handles and reset the curl instance.
if (isset($this->curl_fhs[$ch->id])) {
$fh = $this->curl_fhs[$ch->id];
if (!$ch->error) {
if (!$ch->error && $ch->download_complete_function) {
rewind($fh);
$ch->call($ch->download_complete_function, $fh);
}
if (is_resource($fh)) {
fclose($fh);
}
defined('STDOUT') || define('STDOUT', null);
if (!defined('STDOUT')) {
define('STDOUT', null);
}
$ch->setOpt(CURLOPT_FILE, STDOUT);
$ch->setOpt(CURLOPT_RETURNTRANSFER, true);
unset($fh);
unset($this->curl_fhs[$ch->id]);
}
break;
}