Skip to content

Commit

Permalink
Unset curl handles after closing them
Browse files Browse the repository at this point in the history
  • Loading branch information
pprkut committed Jun 10, 2024
1 parent dcd233c commit 527562b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Transport/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ public function __construct() {
public function __destruct() {
if (is_resource($this->handle)) {
curl_close($this->handle);
unset($this->handle);
}
}

Expand Down Expand Up @@ -307,6 +308,7 @@ public function request_multiple($requests, $options) {

curl_multi_remove_handle($multihandle, $done['handle']);
curl_close($done['handle']);
unset($done['handle']);

if (!is_string($responses[$key])) {
$options['hooks']->dispatch('multiple.request.complete', [&$responses[$key], $key]);
Expand All @@ -319,6 +321,7 @@ public function request_multiple($requests, $options) {
$request['options']['hooks']->dispatch('curl.after_multi_exec', [&$multihandle]);

curl_multi_close($multihandle);
unset($multihandle);

return $responses;
}
Expand Down

0 comments on commit 527562b

Please sign in to comment.