Skip to content

Commit fcf142f

Browse files
committed
Run tests on PHP 8.6 and update test environment
1 parent 3404139 commit fcf142f

4 files changed

Lines changed: 22 additions & 5 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ jobs:
1111
strategy:
1212
matrix:
1313
os:
14-
- ubuntu-24.04
14+
- ubuntu-26.04
1515
- windows-2022
1616
php:
17+
- 8.6
1718
- 8.5
1819
- 8.4
1920
- 8.3
@@ -45,7 +46,7 @@ jobs:
4546
- uses: actions/checkout@v7
4647
- uses: shivammathur/setup-php@v2
4748
with:
48-
php-version: 8.5
49+
php-version: 8.6
4950
coverage: pcov
5051
- run: composer install
5152
- run: vendor/bin/phpunit --coverage-text

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"php": ">=7.1",
3030
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
3131
"react/dns": "^1.13",
32-
"react/event-loop": "^1.2",
32+
"react/event-loop": "^1.6",
3333
"react/promise": "^3.2 || ^2.6 || ^1.2.1",
3434
"react/stream": "^1.4"
3535
},

‎tests/SecureIntegrationTest.php‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace React\Tests\Socket;
44

55
use Evenement\EventEmitterInterface;
6+
use React\EventLoop\Loop;
67
use React\Promise\Deferred;
78
use React\Promise\Promise;
89
use React\Socket\ConnectionInterface;
@@ -118,6 +119,14 @@ public function testSendDataWithEndToServerReceivesAllData()
118119
$client = await(timeout($this->connector->connect($this->address), self::TIMEOUT));
119120
/* @var $client ConnectionInterface */
120121

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+
121130
$data = str_repeat('a', 200000);
122131
$client->end($data);
123132

@@ -180,6 +189,13 @@ public function testConnectToServerWhichSendsDataWithEndReceivesAllData()
180189
{
181190
$data = str_repeat('b', 100000);
182191
$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+
});
183199
$peer->end($data);
184200
});
185201

‎tests/SocketServerTest.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@ public function testConstructorThrowsForExistingUnixPath()
115115
$this->fail();
116116
} catch (\RuntimeException $e) {
117117
if ($e->getCode() === 0) {
118-
// Zend PHP does not currently report a sane error
119-
$this->assertStringEndsWith('Unknown error', $e->getMessage());
118+
// PHP 8.6+ reports error message without errno, earlier versions do not report a sane error
119+
$this->assertStringEndsWith(PHP_VERSION_ID >= 80600 ? 'Address already in use' : 'Unknown error', $e->getMessage());
120120
} else {
121121
$this->assertEquals(SOCKET_EADDRINUSE, $e->getCode());
122122
$this->assertStringEndsWith('Address already in use (EADDRINUSE)', $e->getMessage());

0 commit comments

Comments
 (0)