diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e16d0fb..66bf904 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,9 +11,10 @@ jobs: strategy: matrix: os: - - ubuntu-24.04 + - ubuntu-26.04 - windows-2022 php: + - 8.6 - 8.5 - 8.4 - 8.3 @@ -45,7 +46,7 @@ jobs: - uses: actions/checkout@v7 - uses: shivammathur/setup-php@v2 with: - php-version: 8.5 + php-version: 8.6 coverage: pcov - run: composer install - run: vendor/bin/phpunit --coverage-text diff --git a/composer.json b/composer.json index 9aa4d04..d3a72b4 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "php": ">=7.1", "evenement/evenement": "^3.0 || ^2.0 || ^1.0", "react/dns": "^1.13", - "react/event-loop": "^1.2", + "react/event-loop": "^1.6", "react/promise": "^3.2 || ^2.6 || ^1.2.1", "react/stream": "^1.4" }, diff --git a/tests/SecureIntegrationTest.php b/tests/SecureIntegrationTest.php index c5f3d41..1546724 100644 --- a/tests/SecureIntegrationTest.php +++ b/tests/SecureIntegrationTest.php @@ -3,6 +3,7 @@ namespace React\Tests\Socket; use Evenement\EventEmitterInterface; +use React\EventLoop\Loop; use React\Promise\Deferred; use React\Promise\Promise; use React\Socket\ConnectionInterface; @@ -118,6 +119,14 @@ public function testSendDataWithEndToServerReceivesAllData() $client = await(timeout($this->connector->connect($this->address), self::TIMEOUT)); /* @var $client ConnectionInterface */ + // clear OpenSSL errors from closing the client before the server reads, + // as legacy PHP < 7.2 does not (https://bugs.php.net/bug.php?id=78775) + $client->on('close', function () { + Loop::futureTick(function () { + while (openssl_error_string() !== false); + }); + }); + $data = str_repeat('a', 200000); $client->end($data); @@ -180,6 +189,13 @@ public function testConnectToServerWhichSendsDataWithEndReceivesAllData() { $data = str_repeat('b', 100000); $this->server->on('connection', function (ConnectionInterface $peer) use ($data) { + // clear OpenSSL errors from closing the server side before the client reads, + // as legacy PHP < 7.2 does not (https://bugs.php.net/bug.php?id=78775) + $peer->on('close', function () { + Loop::futureTick(function () { + while (openssl_error_string() !== false); + }); + }); $peer->end($data); }); diff --git a/tests/SocketServerTest.php b/tests/SocketServerTest.php index dec6562..35b8b32 100644 --- a/tests/SocketServerTest.php +++ b/tests/SocketServerTest.php @@ -115,8 +115,8 @@ public function testConstructorThrowsForExistingUnixPath() $this->fail(); } catch (\RuntimeException $e) { if ($e->getCode() === 0) { - // Zend PHP does not currently report a sane error - $this->assertStringEndsWith('Unknown error', $e->getMessage()); + // PHP 8.6+ reports error message without errno, earlier versions do not report a sane error + $this->assertStringEndsWith(PHP_VERSION_ID >= 80600 ? 'Address already in use' : 'Unknown error', $e->getMessage()); } else { $this->assertEquals(SOCKET_EADDRINUSE, $e->getCode()); $this->assertStringEndsWith('Address already in use (EADDRINUSE)', $e->getMessage());