Skip to content

Commit b89b26a

Browse files
committed
Don’t close the cURL handle more than once
When close() was called more than once PHP warnings appeared stating that "XY is not a valid cURL handle resource". This was especially problematic when close() was called manually because it will also *always* be called from the destructor. From no on we’ll first check whether $this->curl is still a resource to avoid that.
1 parent 4a5a95e commit b89b26a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Curl/Curl.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ public function verbose($on=TRUE) {
121121
}
122122

123123
public function close() {
124-
curl_close($this->curl);
124+
if (is_resource($this->curl)) {
125+
curl_close($this->curl);
126+
}
125127
}
126128

127129
public function _exec() {

0 commit comments

Comments
 (0)