diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index eea6ba7..e91b0c2 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -10,7 +10,7 @@ class Curl const VERSION = '8.9.0'; const DEFAULT_TIMEOUT = 30; - public $curl; + public $curl = null; public $id = null; public $error = false; @@ -211,8 +211,9 @@ class Curl */ public function close() { - if (is_resource($this->curl)) { + if ($this->curl !== null) { curl_close($this->curl); + $this->curl = null; } $this->options = null; $this->jsonDecoder = null; @@ -1457,7 +1458,7 @@ class Curl */ public function reset() { - if (function_exists('curl_reset') && is_resource($this->curl)) { + if (function_exists('curl_reset') && $this->curl !== null) { curl_reset($this->curl); } else { $this->curl = curl_init(); diff --git a/src/Curl/MultiCurl.php b/src/Curl/MultiCurl.php index 3219a71..0a59475 100644 --- a/src/Curl/MultiCurl.php +++ b/src/Curl/MultiCurl.php @@ -7,7 +7,7 @@ use Curl\ArrayUtil; class MultiCurl { public $baseUrl = null; - public $multiCurl; + public $multiCurl = null; private $curls = array(); private $activeCurls = array(); @@ -370,8 +370,9 @@ class MultiCurl $curl->close(); } - if (is_resource($this->multiCurl)) { + if ($this->multiCurl !== null) { curl_multi_close($this->multiCurl); + $this->multiCurl = null; } }