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
12 changes: 6 additions & 6 deletions lib/Cleantalk/ApbctWP/HTTP/HTTPMultiRequestService.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,18 @@ public function executeMultiContract()
*/
public function fillMultiContract($http_multi_result)
{
// Handle HTTP request error
if (!empty($http_multi_result['error'])) {
$this->error_msg = __CLASS__ . ': HTTP_MULTI_RESULT ERROR' . $http_multi_result['error'];
return $this;
}

// Validate result is an array
if (!is_array($http_multi_result)) {
$this->error_msg = __CLASS__ . ': HTTP_MULTI_RESULT INVALID';
return $this;
}

// Handle HTTP request error
if (!empty($http_multi_result['error'])) {
$this->error_msg = __CLASS__ . ': HTTP_MULTI_RESULT ERROR: ' . $http_multi_result['error'];
return $this;
}
Comment thread
AntonV1211 marked this conversation as resolved.

// Fill each contract with corresponding response data
foreach ($this->contracts as $contract) {
if (isset($http_multi_result[$contract->url])) {
Expand Down
4 changes: 2 additions & 2 deletions lib/Cleantalk/Common/HTTP/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ protected function runCallbacks()
}
unset($response);

// Return a single content if it was a single request
return is_array($this->response) && count($this->response) > 1
// Return associative array if URLs were passed as array, single value otherwise
return is_array($this->url)
? $return_value
: reset($return_value);
}
Expand Down
Loading