Skip to content

Commit

Permalink
Define curl constants if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
srmklive committed Nov 8, 2018
1 parent 55d906e commit e09737e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/Traits/PayPalHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,30 @@

trait PayPalHttpClient
{
/**
* Set curl constants if not defined.
*
* @return void
*/
protected function setCurlConstants()
{
if (!defined('CURLOPT_SSLVERSION')) {
define('CURLOPT_SSLVERSION', 32);
}

if (!defined('CURL_SSLVERSION_TLSv1_2')) {
define('CURL_SSLVERSION_TLSv1_2', 6);
}

if (!defined('CURLOPT_SSL_VERIFYPEER')) {
define('CURLOPT_SSL_VERIFYPEER', 64);
}

if (!defined('CURLOPT_SSLCERT')) {
define('CURLOPT_SSLCERT', 10025);
}
}

/**
* Function to initialize Http Client.
*
Expand All @@ -28,6 +52,8 @@ protected function setClient()
*/
protected function setHttpClientConfiguration()
{
$this->defineCurlConstants();

$this->httpClientConfig = [
CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2,
CURLOPT_SSL_VERIFYPEER => $this->validateSSL,
Expand Down

3 comments on commit e09737e

@TonyFresneau
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this broke everything (Call to undefined method Srmklive\PayPal\Services\ExpressCheckout::defineCurlConstants()). No need to show you what's wrong it's pretty obvious :)

@srmklive
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks brother for the heads up. Incredibly naive of me to not have checked it before tagging a new release 😝.

@srmklive
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tagged a new release which fixes the issue you reported 😀.

Please sign in to comment.