diff --git a/lib/PayPal/Core/PPConstants.php b/lib/PayPal/Core/PPConstants.php index b1cf97d..4c640f4 100644 --- a/lib/PayPal/Core/PPConstants.php +++ b/lib/PayPal/Core/PPConstants.php @@ -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"; diff --git a/lib/PayPal/Core/PPHttpConfig.php b/lib/PayPal/Core/PPHttpConfig.php index 8a710b0..ced08ef 100644 --- a/lib/PayPal/Core/PPHttpConfig.php +++ b/lib/PayPal/Core/PPHttpConfig.php @@ -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); + } } /** @@ -167,13 +173,23 @@ class PPHttpConfig * Add Curl Option * * @param string $name - * @param mixed $value + * @param mixed $value */ public function addCurlOption($name, $value) { $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 * diff --git a/release_notes.md b/release_notes.md index d00ad6b..92158fd 100644 --- a/release_notes.md +++ b/release_notes.md @@ -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 diff --git a/tests/PayPal/Test/Core/PPHttpConfigTest.php b/tests/PayPal/Test/Core/PPHttpConfigTest.php index 28141ef..e55d160 100644 --- a/tests/PayPal/Test/Core/PPHttpConfigTest.php +++ b/tests/PayPal/Test/Core/PPHttpConfigTest.php @@ -1,11 +1,14 @@ 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 */