diff --git a/src/StreamEncryption.php b/src/StreamEncryption.php index 3a676c4..2a46359 100644 --- a/src/StreamEncryption.php +++ b/src/StreamEncryption.php @@ -18,23 +18,19 @@ class StreamEncryption private $errstr; private $errno; - + private $wrapSecure = false; public function __construct(LoopInterface $loop) { $this->loop = $loop; - + // See https://bugs.php.net/bug.php?id=65137 + // https://bugs.php.net/bug.php?id=41631 + // https://github.com/reactphp/socket-client/issues/24 // On versions affected by this bug we need to fread the stream until we // get an empty string back because the buffer indicator could be wrong - if ( - PHP_VERSION_ID < 50433 - || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50517) - || PHP_VERSION_ID === 50600 - ) { - $this->wrapSecure = true; - } + $this->wrapSecure = true; } public function enable(Stream $stream) @@ -50,7 +46,7 @@ public function disable(Stream $stream) public function toggle(Stream $stream, $toggle) { if (__NAMESPACE__ . '\SecureStream' === get_class($stream)) { - $stream = $stream->decorating; + $stream = $stream->decorating; } // pause actual stream instance to continue operation on raw stream socket @@ -74,9 +70,9 @@ public function toggle(Stream $stream, $toggle) if ($toggle && $this->wrapSecure) { return new SecureStream($stream, $this->loop); } - + $stream->resume(); - + return $stream; }, function($error) use ($stream) { $stream->resume();