|
3 | 3 | namespace React\Tests\Socket; |
4 | 4 |
|
5 | 5 | use Evenement\EventEmitterInterface; |
| 6 | +use React\EventLoop\Loop; |
6 | 7 | use React\Promise\Deferred; |
7 | 8 | use React\Promise\Promise; |
8 | 9 | use React\Socket\ConnectionInterface; |
@@ -118,6 +119,14 @@ public function testSendDataWithEndToServerReceivesAllData() |
118 | 119 | $client = await(timeout($this->connector->connect($this->address), self::TIMEOUT)); |
119 | 120 | /* @var $client ConnectionInterface */ |
120 | 121 |
|
| 122 | + // clear OpenSSL errors from closing the client before the server reads, |
| 123 | + // as legacy PHP < 7.2 does not (https://bugs.php.net/bug.php?id=78775) |
| 124 | + $client->on('close', function () { |
| 125 | + Loop::futureTick(function () { |
| 126 | + while (openssl_error_string() !== false); |
| 127 | + }); |
| 128 | + }); |
| 129 | + |
121 | 130 | $data = str_repeat('a', 200000); |
122 | 131 | $client->end($data); |
123 | 132 |
|
@@ -180,6 +189,13 @@ public function testConnectToServerWhichSendsDataWithEndReceivesAllData() |
180 | 189 | { |
181 | 190 | $data = str_repeat('b', 100000); |
182 | 191 | $this->server->on('connection', function (ConnectionInterface $peer) use ($data) { |
| 192 | + // clear OpenSSL errors from closing the server side before the client reads, |
| 193 | + // as legacy PHP < 7.2 does not (https://bugs.php.net/bug.php?id=78775) |
| 194 | + $peer->on('close', function () { |
| 195 | + Loop::futureTick(function () { |
| 196 | + while (openssl_error_string() !== false); |
| 197 | + }); |
| 198 | + }); |
183 | 199 | $peer->end($data); |
184 | 200 | }); |
185 | 201 |
|
|
0 commit comments