File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -285,13 +285,13 @@ public function sendRequest(Request $request)
285285 $ errno = curl_errno ($ this ->ch );
286286 $ errmsg = curl_error ($ this ->ch );
287287 $ msg = "cURL request failed with error [ $ errno]: $ errmsg " ;
288- curl_close ( $ this ->ch );
288+ $ this ->curlClose ( );
289289 throw new cURLException ($ request , $ msg , $ errno );
290290 }
291291
292292 $ response = $ this ->createResponseObject ($ result , $ request );
293293
294- curl_close ( $ this ->ch );
294+ $ this ->curlClose ( );
295295
296296 return $ response ;
297297 }
@@ -371,4 +371,16 @@ public function __call($func, $args)
371371
372372 return $ this ->sendRequest ($ request );
373373 }
374+
375+ /**
376+ * Closes curl.
377+ * Calls curl_close($this->ch) in php versions when it's relevant
378+ *
379+ * @return void
380+ */
381+ private function curlClose () {
382+ if (version_compare (PHP_VERSION , "8.0.0 " , ">= " ))
383+ return ;
384+ curl_close ($ this ->ch );
385+ }
374386}
You can’t perform that action at this time.
0 commit comments