forked from LiveCarta/PayPal-PHP-SDK
Fixed Curl Options for NSS
This commit is contained in:
@@ -12,7 +12,7 @@ class PPConstants
|
||||
{
|
||||
|
||||
const SDK_NAME = 'PayPal-PHP-SDK';
|
||||
const SDK_VERSION = '0.14.1';
|
||||
const SDK_VERSION = '0.14.2';
|
||||
|
||||
const REST_SANDBOX_ENDPOINT = "https://api.sandbox.paypal.com/";
|
||||
const OPENID_REDIRECT_SANDBOX_URL = "https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect";
|
||||
|
||||
@@ -32,7 +32,6 @@ class PPHttpConfig
|
||||
//Adding it like this for backward compatibility with older versions of curl
|
||||
);
|
||||
|
||||
|
||||
const HEADER_SEPARATOR = ';';
|
||||
const HTTP_GET = 'GET';
|
||||
const HTTP_POST = 'POST';
|
||||
@@ -61,6 +60,13 @@ class PPHttpConfig
|
||||
$this->url = $url;
|
||||
$this->method = $method;
|
||||
$this->curlOptions = self::$defaultCurlOptions;
|
||||
// Update the Cipher List based on OpenSSL or NSS settings
|
||||
$curl = curl_version();
|
||||
$sslVersion = isset($curl['ssl_version']) ? $curl['ssl_version'] : '';
|
||||
if (substr_compare($sslVersion, "NSS/", 0, strlen("NSS/")) === 0) {
|
||||
//Remove the Cipher List for NSS
|
||||
$this->removeCurlOption(CURLOPT_SSL_CIPHER_LIST);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,6 +180,16 @@ class PPHttpConfig
|
||||
$this->curlOptions[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a curl option from the list
|
||||
*
|
||||
* @param $name
|
||||
*/
|
||||
public function removeCurlOption($name)
|
||||
{
|
||||
unset($this->curlOptions[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Curl Options. Overrides all curl options
|
||||
*
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
PayPal PHP SDK release notes
|
||||
============================
|
||||
v0.14.2
|
||||
----
|
||||
* Quick Patch to Unset Cipher List for NSS
|
||||
|
||||
v0.14.1
|
||||
----
|
||||
* Updated HttpConfig to use TLSv1 as Cipher List
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Core;
|
||||
|
||||
use PayPal\Core\PPHttpConfig;
|
||||
|
||||
/**
|
||||
* Test class for PPAPIService.
|
||||
*
|
||||
*/
|
||||
class PPHttpConfigTest extends PHPUnit_Framework_TestCase
|
||||
class PPHttpConfigTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
protected $object;
|
||||
@@ -72,6 +75,19 @@ class PPHttpConfigTest extends PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('v', $curlOpts['k']);
|
||||
}
|
||||
|
||||
public function testRemoveCurlOpts()
|
||||
{
|
||||
$o = new PPHttpConfig();
|
||||
$o->setCurlOptions(array('k' => 'v'));
|
||||
$curlOpts = $o->getCurlOptions();
|
||||
$this->assertEquals(1, count($curlOpts));
|
||||
$this->assertEquals('v', $curlOpts['k']);
|
||||
|
||||
$o->removeCurlOption('k');
|
||||
$curlOpts = $o->getCurlOptions();
|
||||
$this->assertEquals(0, count($curlOpts));
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user