Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Remove SSL method validation
Browse files Browse the repository at this point in the history
  • Loading branch information
lku committed Jun 10, 2015
1 parent 5fa99b7 commit 4b4bbf5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 56 deletions.
17 changes: 0 additions & 17 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,6 @@ class Client implements ServerClient
*/
protected $sslMethod;

/**
* @var int[]
*/
protected static $supportedSslMethods = [
SOAP_SSL_METHOD_TLS,
SOAP_SSL_METHOD_SSLv2,
SOAP_SSL_METHOD_SSLv3,
SOAP_SSL_METHOD_SSLv23
];

/**#@+
* @var string
*/
Expand Down Expand Up @@ -1279,13 +1269,6 @@ public function getSslMethod()
*/
public function setSslMethod($sslMethod)
{
if (!in_array($sslMethod, static::$supportedSslMethods, true)) {
throw new Exception\InvalidArgumentException(sprintf(
'Invalid SSL method specified. Use one of %s constants.',
'SOAP_SSL_METHOD_TLS, SOAP_SSL_METHOD_SSLv2, SOAP_SSL_METHOD_SSLv3, SOAP_SSL_METHOD_SSLv23'
));
}

$this->sslMethod = $sslMethod;
return $this;
}
Expand Down
42 changes: 3 additions & 39 deletions test/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function testSetOptions()
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5,
'typemap' => $typeMap,
'keep_alive' => true,
'ssl_method' => SOAP_SSL_METHOD_SSLv23,
'ssl_method' => 3,
];

$client->setOptions($nonWSDLOptions);
Expand Down Expand Up @@ -116,7 +116,7 @@ public function testSetOptions()
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5,
'typemap' => $typeMap,
'keep_alive' => true,
'ssl_method' => SOAP_SSL_METHOD_SSLv23,
'ssl_method' => 3,
];

$client1->setOptions($wsdlOptions);
Expand Down Expand Up @@ -169,7 +169,7 @@ public function testGetOptions()
'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP | 5,
'typemap' => $typeMap,
'keep_alive' => true,
'ssl_method' => SOAP_SSL_METHOD_SSLv23,
'ssl_method' => 3,
];

$client->setOptions($options);
Expand Down Expand Up @@ -586,42 +586,6 @@ public function testSetSoapClient()
$this->assertSame($clientMock, $soap->getSoapClient());
}

/**
* @expectedException \Zend\Soap\Exception\InvalidArgumentException
* @expectedExceptionMessage Invalid SSL method specified.
*/
public function testSetInvalidSslMethod()
{
new Client(null, [
'ssl_method' => 'invalid',
]);
}

/**
* Are all SSL method constants defined in SOAP extension supported?
*/
public function testAllSslMethodsAreSupported()
{
$constants = get_defined_constants(true);
$soapConstants = $constants['soap'];

// filter all constant names started with 'SOAP_SSL_METHOD_' string
$sslMethodsConstants = array_filter(
array_keys($soapConstants),
function ($constantName) {
return (strpos($constantName, 'SOAP_SSL_METHOD_') === 0);
}
);

// get constants values
$sslMethodConstantsValues = array_intersect_key($soapConstants, array_flip($sslMethodsConstants));

$this->assertEquals(
array_values($sslMethodConstantsValues),
self::readAttribute('Zend\Soap\Client', 'supportedSslMethods')
);
}

/**
* @expectedException \Zend\Soap\Exception\UnexpectedValueException
* @dataProvider dataProviderForInitSoapClientObjectException
Expand Down

0 comments on commit 4b4bbf5

Please sign in to comment.