Skip to content

Commit e3122b1

Browse files
committed
Merge branch 'ssl-refix'
2 parents 3cc2bfd + b302dfc commit e3122b1

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/StreamEncryption.php

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,19 @@ class StreamEncryption
1818

1919
private $errstr;
2020
private $errno;
21-
21+
2222
private $wrapSecure = false;
2323

2424
public function __construct(LoopInterface $loop)
2525
{
2626
$this->loop = $loop;
27-
27+
2828
// See https://bugs.php.net/bug.php?id=65137
29+
// https://bugs.php.net/bug.php?id=41631
30+
// https://github.com/reactphp/socket-client/issues/24
2931
// On versions affected by this bug we need to fread the stream until we
3032
// get an empty string back because the buffer indicator could be wrong
31-
if (
32-
PHP_VERSION_ID < 50433
33-
|| (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50517)
34-
|| PHP_VERSION_ID === 50600
35-
) {
36-
$this->wrapSecure = true;
37-
}
33+
$this->wrapSecure = true;
3834
}
3935

4036
public function enable(Stream $stream)
@@ -50,7 +46,7 @@ public function disable(Stream $stream)
5046
public function toggle(Stream $stream, $toggle)
5147
{
5248
if (__NAMESPACE__ . '\SecureStream' === get_class($stream)) {
53-
$stream = $stream->decorating;
49+
$stream = $stream->decorating;
5450
}
5551

5652
// pause actual stream instance to continue operation on raw stream socket
@@ -74,9 +70,9 @@ public function toggle(Stream $stream, $toggle)
7470
if ($toggle && $this->wrapSecure) {
7571
return new SecureStream($stream, $this->loop);
7672
}
77-
73+
7874
$stream->resume();
79-
75+
8076
return $stream;
8177
}, function($error) use ($stream) {
8278
$stream->resume();

0 commit comments

Comments
 (0)