-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only do file_get_contents on PHP versions needed
- Loading branch information
Showing
1 changed file
with
14 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,10 +18,23 @@ 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 | ||
// 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 >= 50000 && PHP_VERSION_ID < 50517) | ||
|| PHP_VERSION_ID === 50600 | ||
) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
DaveRandom
Contributor
|
||
$this->wrapSecure = true; | ||
} | ||
} | ||
|
||
public function enable(Stream $stream) | ||
|
@@ -59,7 +72,7 @@ public function toggle(Stream $stream, $toggle) | |
$toggleCrypto(); | ||
|
||
return $deferred->promise()->then(function () use ($stream, $toggle) { | ||
if ($toggle) { | ||
if ($toggle && $this->wrapSecure) { | ||
return new SecureStream($stream, $this->loop); | ||
} | ||
|
||
|
@DaveRandom Can you confirm this is targeting all the correct versions please?