From 8c3ef438123c659b859e937ee8be55d5a8970285 Mon Sep 17 00:00:00 2001 From: Gabor Sipos Date: Fri, 20 Jul 2018 19:14:17 +0200 Subject: [PATCH] Setting TLSv1.2 option for CURL if php version is below 5.6 --- library/BarionClient.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/library/BarionClient.php b/library/BarionClient.php index 3563a9d..38bec04 100755 --- a/library/BarionClient.php +++ b/library/BarionClient.php @@ -210,6 +210,10 @@ private function PostToBarion($url, $data) curl_setopt($ch, CURLOPT_POSTFIELDS, $postData); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "User-Agent: $userAgent")); + + if(substr(phpversion(), 0, 3) < 5.6) { + curl_setopt($ch, CURLOPT_SSLVERSION, 6); + } if ($this->UseBundledRootCertificates) { curl_setopt($ch, CURLOPT_CAINFO, join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'ssl', 'cacert.pem'))); @@ -259,6 +263,10 @@ private function GetFromBarion($url, $data) curl_setopt($ch, CURLOPT_URL, $fullUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array("User-Agent: $userAgent")); + + if(substr(phpversion(), 0, 3) < 5.6) { + curl_setopt($ch, CURLOPT_SSLVERSION, 6); + } if ($this->UseBundledRootCertificates) { curl_setopt($ch, CURLOPT_CAINFO, join(DIRECTORY_SEPARATOR, array(dirname(__FILE__), 'ssl', 'cacert.pem')));