Skip to content

Commit 345690c

Browse files
committed
Work around legacy HHVM < 3.8 (does not support TLS connections)
1 parent 26becac commit 345690c

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

src/SecureConnector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function __construct(ConnectorInterface $connector, LoopInterface $loop,
2222
public function connect($uri)
2323
{
2424
if (!function_exists('stream_socket_enable_crypto')) {
25-
return Promise\reject(new \BadMethodCallException('Encryption not supported on your platform (HHVM < 3.8?)'));
25+
return Promise\reject(new \BadMethodCallException('Encryption not supported on your platform (HHVM < 3.8?)')); // @codeCoverageIgnore
2626
}
2727

2828
if (strpos($uri, '://') === false) {

src/SecureServer.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,16 @@ final class SecureServer extends EventEmitter implements ServerInterface
112112
* @param ServerInterface|Server $tcp
113113
* @param LoopInterface $loop
114114
* @param array $context
115+
* @throws \BadMethodCallException for legacy HHVM < 3.8 due to lack of support
115116
* @see Server
116117
* @link http://php.net/manual/en/context.ssl.php for TLS context options
117118
*/
118119
public function __construct(ServerInterface $tcp, LoopInterface $loop, array $context)
119120
{
121+
if (!function_exists('stream_socket_enable_crypto')) {
122+
throw new \BadMethodCallException('Encryption not supported on your platform (HHVM < 3.8?)'); // @codeCoverageIgnore
123+
}
124+
120125
// default to empty passphrase to surpress blocking passphrase prompt
121126
$context += array(
122127
'passphrase' => ''

src/StreamEncryption.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ class StreamEncryption
2626

2727
public function __construct(LoopInterface $loop, $server = true)
2828
{
29-
if (!function_exists('stream_socket_enable_crypto')) {
30-
throw new \BadMethodCallException('Encryption not supported on your platform (HHVM < 3.8?)');
31-
}
32-
3329
$this->loop = $loop;
3430
$this->server = $server;
3531

src/TcpConnector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function connect($uri)
6969
// HHVM fails to parse URIs with a query but no path, so let's add a dummy path
7070
// See also https://3v4l.org/jEhLF
7171
if (defined('HHVM_VERSION') && isset($parts['query']) && !isset($parts['path'])) {
72-
$uri = str_replace('?', '/?', $uri);
72+
$uri = str_replace('?', '/?', $uri); // @codeCoverageIgnore
7373
}
7474

7575
$socket = @stream_socket_client(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy