From eb68981c8a3a8887fea9305bac4c4c9a6a475c2e Mon Sep 17 00:00:00 2001 From: blackcoder87 Date: Fri, 9 Aug 2024 16:54:21 +0200 Subject: [PATCH] Fix storing curl options in array (#1028) --- application/libraries/Ilch/Transfer.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/application/libraries/Ilch/Transfer.php b/application/libraries/Ilch/Transfer.php index b8978eac5..d98f703ed 100644 --- a/application/libraries/Ilch/Transfer.php +++ b/application/libraries/Ilch/Transfer.php @@ -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); @@ -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; }