Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,13 +32,14 @@ jobs:
- 5.3
steps:
- uses: actions/checkout@v7
- run: choco install vcredist2012 -y --no-progress
if: ${{ matrix.php >= 5.5 && matrix.php < 7.0 && matrix.os == 'windows-2022' }} # legacy PHP 5.5/5.6 on Windows needs VC 2012 pre-installed until https://github.com/mlocati/powershell-phpmanager/pull/142 is released
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
ini-file: development
- run: composer config secure-http false && composer config repo.packagist composer http://packagist.org && composer config preferred-install source
if: ${{ matrix.php < 5.5 && matrix.os == 'windows-2022' }} # legacy PHP on Windows is allowed to use insecure downloads until it will be removed again
tools: ${{ matrix.php < 5.5 && matrix.os == 'windows-2022' && 'composer:2.2.30' || '' }} # legacy PHP < 5.5 on Windows crashes with Composer 2.2.31+ until https://github.com/composer/composer/issues/13276 is fixed
- run: composer install
- run: vendor/bin/phpunit --coverage-text
if: ${{ matrix.php >= 7.3 }}
Expand All @@ -52,14 +54,14 @@ jobs:
- uses: actions/checkout@v7
- uses: shivammathur/setup-php@v2
with:
php-version: 8.5
php-version: 8.6
coverage: xdebug
- run: composer install
- run: vendor/bin/phpunit --coverage-text

PHPUnit-hhvm:
name: PHPUnit (HHVM)
runs-on: ubuntu-24.04
runs-on: ubuntu-26.04
continue-on-error: true
steps:
- uses: actions/checkout@v7
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"php": ">=5.3.0",
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
"react/dns": "^1.13",
"react/event-loop": "^1.2",
"react/promise": "^3.2 || ^2.6 || ^1.2.1",
"react/event-loop": "^1.6",
"react/promise": "^3.3 || ^2.6 || ^1.2.1",
"react/stream": "^1.4"
},
"require-dev": {
Expand Down
16 changes: 16 additions & 0 deletions tests/SecureIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -124,6 +125,14 @@ public function testSendDataWithEndToServerReceivesAllData()
$client = \React\Async\await(\React\Promise\Timer\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);

Expand Down Expand Up @@ -186,6 +195,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);
});

Expand Down
4 changes: 2 additions & 2 deletions tests/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,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());
Expand Down
4 changes: 2 additions & 2 deletions tests/SocketServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,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());
Expand Down