Skip to content

Commit

Permalink
Fix storing curl options in array (#1028)
Browse files Browse the repository at this point in the history
  • Loading branch information
blackcoder87 authored Aug 9, 2024
1 parent 52cda74 commit eb68981
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions application/libraries/Ilch/Transfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ public function getVersions(): ?array
// curl_exec: Returns true on success or false on failure. However, if the CURLOPT_RETURNTRANSFER option is set, it will return the result on success, false on failure.
// This function may return Boolean false, but may also return a non-Boolean value which evaluates to false.

// Set CURLOPT_RETURNTRANSFER to 1 as this is required for this function.
$previousValue = $this->curlOpt['CURLOPT_RETURNTRANSFER'] ?? 0;
// Set CURLOPT_RETURNTRANSFER as this is required for this function.
$previousValue = $this->curlOpt[CURLOPT_RETURNTRANSFER] ?? 0;

if (!$previousValue) {
$this->setCurlOpt(CURLOPT_RETURNTRANSFER, 1);
Expand Down Expand Up @@ -351,7 +351,9 @@ public function checkRequirements($requirements): bool
public function setCurlOpt(int $opt, $param): Transfer
{
if (!empty($this->transferUrl)) {
$this->curlOpt[] = curl_setopt($this->transferUrl, $opt, $param);
if (curl_setopt($this->transferUrl, $opt, $param)) {
$this->curlOpt[$opt] = $param;
}
}
return $this;
}
Expand Down

0 comments on commit eb68981

Please sign in to comment.