@@ -81,7 +81,7 @@ public function __construct()
8181 */
8282 public function getCurlError ()
8383 {
84- return isset ($ this ->res ->error ) ?: $ this ->res ->error ;
84+ return isset ($ this ->res ->error ) && ! \is_resource ( $ this -> req -> ch ) ?: $ this ->res ->error ;
8585 }
8686
8787 /**
@@ -382,12 +382,12 @@ public function trace($url, $headers = [])
382382 public function exec (): void
383383 {
384384 $ response = curl_exec ($ this ->req ->ch );
385- $ header_size = $ this ->getInfo (\CURLINFO_HEADER_SIZE );
386- $ http_code = $ this ->getInfo (\CURLINFO_HTTP_CODE );
387- $ effective_url = $ this ->getInfo (\CURLINFO_EFFECTIVE_URL );
388- $ total_time = $ this ->getInfo (\CURLINFO_TOTAL_TIME );
385+ $ header_size = $ this ->curlGetInfo (\CURLINFO_HEADER_SIZE );
386+ $ http_code = $ this ->curlGetInfo (\CURLINFO_HTTP_CODE );
387+ $ effective_url = $ this ->curlGetInfo (\CURLINFO_EFFECTIVE_URL );
388+ $ total_time = $ this ->curlGetInfo (\CURLINFO_TOTAL_TIME );
389389 $ headers = trim (substr ($ response , 0 , intval ($ header_size )));
390- $ this ->res ->info = $ this ->getInfo ();
390+ $ this ->res ->info = $ this ->curlGetInfo ();
391391 $ this ->res ->code = $ http_code ;
392392 $ this ->res ->effective_url = $ effective_url ;
393393 $ this ->res ->total_time = $ total_time ;
@@ -401,6 +401,7 @@ public function exec(): void
401401 $ this ->res ->error = curl_error ($ this ->req ->ch );
402402 }
403403 curl_close ($ this ->req ->ch );
404+ $ this ->req ->ch = null ;
404405 }
405406
406407 /**
@@ -677,12 +678,12 @@ public function setUserAgent(string $useragent = null)
677678 }
678679
679680 /**
680- * Curl getinfo function short version
681+ * Curl getinfo function private short version
681682 *
682683 * @param mixed $opt
683684 * @return mixed
684685 */
685- protected function getInfo ($ opt = null )
686+ private function curlGetInfo ($ opt = null )
686687 {
687688 if (\is_null ($ opt )) {
688689 return curl_getinfo ($ this ->req ->ch );
@@ -691,12 +692,12 @@ protected function getInfo($opt = null)
691692 }
692693
693694 /**
694- * Curl getinfo function short version
695+ * Curl getinfo function public short version
695696 *
696697 * @param mixed $opt
697698 * @return mixed
698699 */
699- public function getInfos ($ key = null )
700+ public function getInfo ($ key = null )
700701 {
701702 if (\is_null ($ key )) {
702703 return $ this ->res ->info ;
0 commit comments