Verified Commit cf0adde3 authored by Richard Weinhold's avatar Richard Weinhold 🔨

fixes curl options building with array_merge...

parent eceb384f
......@@ -29,13 +29,10 @@ abstract class Handler
}
}
/**
* @return array|null
*/
protected function getCurlCAPathOptions(): ?array
protected function applyCACertOptions(array $options): array
{
if ($this->caCertPath === null) {
return null;
return $options;
}
$caCertPath = realpath($this->caCertPath);
......@@ -44,10 +41,12 @@ abstract class Handler
}
if (is_dir($caCertPath)) {
return [CURLOPT_CAPATH => $caCertPath];
$options[CURLOPT_CAPATH] = $caCertPath;
return $options;
}
return [CURLOPT_CAINFO => $caCertPath];
$options[CURLOPT_CAINFO] = $caCertPath;
return $options;
}
public function addDevice(string $token): void
......
......@@ -123,9 +123,7 @@ class APNS extends Handler
$options[CURLOPT_KEYPASSWD] = $this->certPassphrase;
}
if (null !== $caCertOptions = $this->getCurlCAPathOptions()) {
$options = array_merge($options, $caCertOptions);
}
$options = $this->applyCACertOptions($options);
$curl = curl_init();
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
......
......@@ -96,9 +96,7 @@ class FCM extends Handler
CURLOPT_TIMEOUT => $this->timeout,
];
if (null !== $caCertOptions = $this->getCurlCAPathOptions()) {
$options = array_merge($options, $caCertOptions);
}
$options = $this->applyCACertOptions($options);
$curl = curl_init();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment