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_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 REST_SANDBOX_ENDPOINT = "https://api.sandbox.paypal.com/";
|
||||||
const OPENID_REDIRECT_SANDBOX_URL = "https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect";
|
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
|
//Adding it like this for backward compatibility with older versions of curl
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
const HEADER_SEPARATOR = ';';
|
const HEADER_SEPARATOR = ';';
|
||||||
const HTTP_GET = 'GET';
|
const HTTP_GET = 'GET';
|
||||||
const HTTP_POST = 'POST';
|
const HTTP_POST = 'POST';
|
||||||
@@ -61,6 +60,13 @@ class PPHttpConfig
|
|||||||
$this->url = $url;
|
$this->url = $url;
|
||||||
$this->method = $method;
|
$this->method = $method;
|
||||||
$this->curlOptions = self::$defaultCurlOptions;
|
$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
|
* Add Curl Option
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
*/
|
*/
|
||||||
public function addCurlOption($name, $value)
|
public function addCurlOption($name, $value)
|
||||||
{
|
{
|
||||||
$this->curlOptions[$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
|
* Set Curl Options. Overrides all curl options
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
PayPal PHP SDK release notes
|
PayPal PHP SDK release notes
|
||||||
============================
|
============================
|
||||||
|
v0.14.2
|
||||||
|
----
|
||||||
|
* Quick Patch to Unset Cipher List for NSS
|
||||||
|
|
||||||
v0.14.1
|
v0.14.1
|
||||||
----
|
----
|
||||||
* Updated HttpConfig to use TLSv1 as Cipher List
|
* Updated HttpConfig to use TLSv1 as Cipher List
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace PayPal\Test\Core;
|
||||||
|
|
||||||
use PayPal\Core\PPHttpConfig;
|
use PayPal\Core\PPHttpConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test class for PPAPIService.
|
* Test class for PPAPIService.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class PPHttpConfigTest extends PHPUnit_Framework_TestCase
|
class PPHttpConfigTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $object;
|
protected $object;
|
||||||
@@ -72,6 +75,19 @@ class PPHttpConfigTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals('v', $curlOpts['k']);
|
$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
|
* @test
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user