Skip to content

Commit 101c4a9

Browse files
committed
comments
1 parent a2e11ce commit 101c4a9

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

src/Client.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,10 @@ class Client
143143
*/
144144
protected $verifyhost = 2;
145145
/**
146-
* @var int
146+
* @var int Corresponds to CURL_SSLVERSION_DEFAULT. Other CURL_SSLVERSION_ values are supported when in socket mode,
147+
* and in socket mode different values from 0 to 7, with old php versions not supporting all of them
147148
*/
148-
protected $sslversion = 0; // corresponds to CURL_SSLVERSION_DEFAULT. Other CURL_SSLVERSION_ values are supported
149+
protected $sslversion = 0; //
149150
/**
150151
* @var string
151152
*/
@@ -585,6 +586,7 @@ public function setSSLVerifyHost($i)
585586
* Set attributes for SSL communication: SSL version to use. Best left at 0 (default value): let PHP decide.
586587
*
587588
* @param int $i use CURL_SSLVERSION_ constants. When in socket mode, use values 2 (SSLv2) to 7 (TLSv1.3). 0 for auto
589+
* (note that old php versions do not support all TLS versions)
588590
* @return $this
589591
* @deprecated use setOption
590592
*/
@@ -1073,16 +1075,16 @@ protected function sendViaSocket($req, $method, $server, $port, $path, $opts)
10731075
case 3: // SSLv3
10741076
$contextOptions['ssl']['crypto_method'] = STREAM_CRYPTO_METHOD_SSLv3_CLIENT;
10751077
break;
1076-
case 4: // TLSv1.0
1078+
case 4: // TLSv1.0 - not always available
10771079
$contextOptions['ssl']['crypto_method'] = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT;
10781080
break;
1079-
case 5: // TLSv1.1
1081+
case 5: // TLSv1.1 - not always available
10801082
$contextOptions['ssl']['crypto_method'] = STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
10811083
break;
1082-
case 6: // TLSv1.2
1084+
case 6: // TLSv1.2 - not always available
10831085
$contextOptions['ssl']['crypto_method'] = STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
10841086
break;
1085-
case 7: // TLSv1.3
1087+
case 7: // TLSv1.3 - not always available
10861088
if (defined('STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT')) {
10871089
$contextOptions['ssl']['crypto_method'] = STREAM_CRYPTO_METHOD_TLSv1_3_CLIENT;
10881090
} else {

tests/09HTTPTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ public function testHttpsSocket($method)
315315
}
316316

317317
/// @todo investigate: can we make this work?
318+
/// See changes in STREAM_CRYPTO_METHOD_TLS constants in 7.2 at https://wiki.php.net/rfc/improved-tls-constants
319+
/// and in 5.6 at https://www.php.net/manual/en/migration56.openssl.php#migration56.openssl.crypto-method
318320
if (version_compare(PHP_VERSION, '7.2', '<'))
319321
{
320322
if (is_readable('/etc/os-release')) {
@@ -349,7 +351,8 @@ public function testHttpsSocket($method)
349351
$this->client->setOption(\PhpXmlRpc\Client::OPT_EXTRA_SOCKET_OPTS,
350352
array('ssl' => array('security_level' => min(2 + $version[1], 5))));
351353
/// @todo we should probably look deeper into the Apache config / ssl version in use to find out why this
352-
/// does not work well with TLS < 1.2
354+
/// does not work well with TLS < 1.2.
355+
/// Also: push this IF to the test matrix config, leave here only setting of security_level
353356
if ($this->args['SSLVERSION'] == 0) {
354357
$this->client->setSSLVersion(min(5 + $version[1], 7));
355358
}

0 commit comments

Comments
 (0)