Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ All notable changes to this project will be documented in this file. This projec

## 2.5.0

+ [#95](https://github.com/php-mod/curl/issues/95) Potential memory leak prevention where curl object was not destroyed due to object reference.
+ [#94](https://github.com/php-mod/curl/pull/94) Added method to retrieve all curl options from current object.
+ [#93](https://github.com/php-mod/curl/pull/93) Text and Coding Standards update
+ [#93](https://github.com/php-mod/curl/pull/93) Text and Coding Standards update.

## 2.4.0 (29. August 2022)

Expand Down
5 changes: 3 additions & 2 deletions src/Curl/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ private function init()
$this->setOpt(CURLINFO_HEADER_OUT, true);
$this->setOpt(CURLOPT_HEADER, false);
$this->setOpt(CURLOPT_RETURNTRANSFER, true);
$this->setOpt(CURLOPT_HEADERFUNCTION, array($this, 'addResponseHeaderLine'));

return $this;
}

Expand Down Expand Up @@ -208,6 +208,7 @@ public function addResponseHeaderLine($curl, $header_line)
*/
public function exec()
{
$this->setOpt(CURLOPT_HEADERFUNCTION, array($this, 'addResponseHeaderLine'));
$this->response_headers = array();
$this->response = curl_exec($this->curl);
$this->curl_error_code = curl_errno($this->curl);
Expand All @@ -220,7 +221,7 @@ public function exec()
$this->request_headers = preg_split('/\r\n/', curl_getinfo($this->curl, CURLINFO_HEADER_OUT), -1, PREG_SPLIT_NO_EMPTY);
$this->http_error_message = $this->error ? (isset($this->response_headers['0']) ? $this->response_headers['0'] : '') : '';
$this->error_message = $this->curl_error ? $this->getErrorMessage() : $this->http_error_message;

$this->setOpt(CURLOPT_HEADERFUNCTION, null);
return $this->error_code;
}

Expand Down