Skip to content

Commit 8d1f815

Browse files
committed
Run tests on PHP 8.6 and update test environment
1 parent a58e432 commit 8d1f815

4 files changed

Lines changed: 35 additions & 4 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ on:
77
jobs:
88
PHPUnit:
99
name: PHPUnit (PHP ${{ matrix.php }})
10-
runs-on: ubuntu-24.04
10+
runs-on: ubuntu-26.04
1111
strategy:
1212
matrix:
1313
php:
14+
- 8.6
1415
- 8.5
1516
- 8.4
1617
- 8.3
@@ -22,7 +23,7 @@ jobs:
2223
- 7.2
2324
- 7.1
2425
steps:
25-
- uses: actions/checkout@v4
26+
- uses: actions/checkout@v7
2627
- uses: shivammathur/setup-php@v2
2728
with:
2829
php-version: ${{ matrix.php }}

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
3131
"fig/http-message-util": "^1.1",
3232
"psr/http-message": "^2.0 || ^1.0",
33-
"react/event-loop": "^1.2",
33+
"react/event-loop": "^1.6",
3434
"react/promise": "^3.2 || ^2.3 || ^1.2.1",
3535
"react/socket": "^1.16",
3636
"react/stream": "^1.4"

‎tests/FunctionalHttpServerTest.php‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,16 @@ public function testSecureHttpsOnRandomPort()
142142
]]);
143143
$http->listen($socket);
144144

145+
// clear OpenSSL errors from closing the server side before the client reads,
146+
// as legacy PHP < 7.2 does not (https://bugs.php.net/bug.php?id=78775)
147+
$socket->on('connection', function (ConnectionInterface $conn) {
148+
$conn->on('close', function () {
149+
Loop::futureTick(function () {
150+
while (openssl_error_string() !== false);
151+
});
152+
});
153+
});
154+
145155
$result = $connector->connect($socket->getAddress())->then(function (ConnectionInterface $conn) {
146156
$conn->write("GET / HTTP/1.0\r\nHost: " . noScheme($conn->getRemoteAddress()) . "\r\n\r\n");
147157

@@ -169,6 +179,16 @@ public function testSecureHttpsReturnsData()
169179
$socket = new SocketServer('tls://127.0.0.1:0', ['tls' => ['local_cert' => __DIR__ . '/../examples/localhost.pem']]);
170180
$http->listen($socket);
171181

182+
// clear OpenSSL errors from closing the server side before the client reads,
183+
// as legacy PHP < 7.2 does not (https://bugs.php.net/bug.php?id=78775)
184+
$socket->on('connection', function (ConnectionInterface $conn) {
185+
$conn->on('close', function () {
186+
Loop::futureTick(function () {
187+
while (openssl_error_string() !== false);
188+
});
189+
});
190+
});
191+
172192
$connector = new Connector(['tls' => [
173193
'verify_peer' => false
174194
]]);
@@ -203,6 +223,16 @@ public function testSecureHttpsOnRandomPortWithoutHostHeaderUsesSocketUri()
203223
]]);
204224
$http->listen($socket);
205225

226+
// clear OpenSSL errors from closing the server side before the client reads,
227+
// as legacy PHP < 7.2 does not (https://bugs.php.net/bug.php?id=78775)
228+
$socket->on('connection', function (ConnectionInterface $conn) {
229+
$conn->on('close', function () {
230+
Loop::futureTick(function () {
231+
while (openssl_error_string() !== false);
232+
});
233+
});
234+
});
235+
206236
$result = $connector->connect($socket->getAddress())->then(function (ConnectionInterface $conn) {
207237
$conn->write("GET / HTTP/1.0\r\n\r\n");
208238

‎tests/Io/AbstractMessageTest.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class MessageMock extends AbstractMessage
1515
*/
1616
public function __construct($protocolVersion, array $headers, StreamInterface $body)
1717
{
18-
return parent::__construct($protocolVersion, $headers, $body);
18+
parent::__construct($protocolVersion, $headers, $body);
1919
}
2020
}
2121

0 commit comments

Comments
 (0)