Skip to content

Commit a6cc6bb

Browse files
committed
Update to require PHP 7.1+
1 parent aa26641 commit a6cc6bb

File tree

7 files changed

+7
-46
lines changed

7 files changed

+7
-46
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ jobs:
1919
- 7.3
2020
- 7.2
2121
- 7.1
22-
- 7.0
23-
- 5.6
24-
- 5.5
25-
- 5.4
26-
- 5.3
2722
steps:
2823
- uses: actions/checkout@v4
2924
- uses: shivammathur/setup-php@v2
@@ -50,19 +45,3 @@ jobs:
5045
ini-file: development
5146
- run: composer install
5247
- run: vendor/bin/phpunit --coverage-text
53-
54-
PHPUnit-hhvm:
55-
name: PHPUnit (HHVM)
56-
runs-on: ubuntu-22.04
57-
continue-on-error: true
58-
steps:
59-
- uses: actions/checkout@v4
60-
- run: cp "$(which composer)" composer.phar && ./composer.phar self-update --2.2 # downgrade Composer for HHVM
61-
- name: Run hhvm composer.phar install
62-
uses: docker://hhvm/hhvm:3.30-lts-latest
63-
with:
64-
args: hhvm composer.phar install
65-
- name: Run hhvm vendor/bin/phpunit
66-
uses: docker://hhvm/hhvm:3.30-lts-latest
67-
with:
68-
args: hhvm vendor/bin/phpunit

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,7 @@ composer require react/dns:^3@dev
424424
See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.
425425

426426
This project aims to run on any platform and thus does not require any PHP
427-
extensions and supports running on legacy PHP 5.3 through current PHP 8+ and
428-
HHVM.
427+
extensions and supports running on PHP 7.1 through current PHP 8+.
429428
It's *highly recommended to use the latest supported PHP version* for this project.
430429

431430
## Tests

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
}
2727
],
2828
"require": {
29-
"php": ">=5.3.0",
29+
"php": ">=7.1",
3030
"react/cache": "^1.0 || ^0.6 || ^0.5",
3131
"react/event-loop": "^1.2",
3232
"react/promise": "^3.0 || ^2.7 || ^1.2.1"
3333
},
3434
"require-dev": {
35-
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36",
35+
"phpunit/phpunit": "^9.6 || ^5.7",
3636
"react/async": "^4 || ^3 || ^2",
3737
"react/promise-timer": "^1.9"
3838
},

phpunit.xml.legacy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!-- PHPUnit configuration file with old format for legacy PHPUnit -->
44
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.8/phpunit.xsd"
5+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/5.7/phpunit.xsd"
66
bootstrap="vendor/autoload.php"
77
colors="true">
88
<testsuites>

src/Model/Message.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,23 +126,13 @@ public static function createResponseWithAnswersForQuery(Query $query, array $an
126126
* DNS response messages can not guess the message ID to avoid possible
127127
* cache poisoning attacks.
128128
*
129-
* The `random_int()` function is only available on PHP 7+ or when
130-
* https://github.com/paragonie/random_compat is installed. As such, using
131-
* the latest supported PHP version is highly recommended. This currently
132-
* falls back to a less secure random number generator on older PHP versions
133-
* in the hope that this system is properly protected against outside
134-
* attackers, for example by using one of the common local DNS proxy stubs.
135-
*
136129
* @return int
137130
* @see self::getId()
138131
* @codeCoverageIgnore
139132
*/
140133
private static function generateId()
141134
{
142-
if (function_exists('random_int')) {
143-
return random_int(0, 0xffff);
144-
}
145-
return mt_rand(0, 0xffff);
135+
return random_int(0, 0xffff);
146136
}
147137

148138
/**

tests/FunctionalResolverTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,6 @@ public function testResolveInvalidRejects()
123123

124124
public function testResolveCancelledRejectsImmediately()
125125
{
126-
// max_nesting_level was set to 100 for PHP Versions < 5.4 which resulted in failing test for legacy PHP
127-
ini_set('xdebug.max_nesting_level', 256);
128-
129126
$promise = $this->resolver->resolve('google.com');
130127
$promise->cancel();
131128

tests/Query/TcpTransportExecutorTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,6 @@ public function testQueryRejectsIfMessageExceedsMaximumMessageSize()
117117

118118
public function testQueryRejectsIfServerConnectionFails()
119119
{
120-
if (defined('HHVM_VERSION')) {
121-
$this->markTestSkipped('HHVM reports different error message for invalid addresses');
122-
}
123-
124120
$loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();
125121
$loop->expects($this->never())->method('addWriteStream');
126122

@@ -403,11 +399,11 @@ public function testQueryRejectsWhenClientKeepsSendingWhenServerClosesSocketWith
403399
restore_error_handler();
404400
$this->assertNull($error);
405401

406-
// expect EPIPE (Broken pipe), except for macOS kernel race condition or legacy HHVM
402+
// expect EPIPE (Broken pipe), except for macOS kernel race condition
407403
$this->setExpectedException(
408404
'RuntimeException',
409405
'Unable to send query to DNS server tcp://' . $address . ' (',
410-
defined('SOCKET_EPIPE') && !defined('HHVM_VERSION') ? (PHP_OS !== 'Darwin' || $writePending ? SOCKET_EPIPE : SOCKET_EPROTOTYPE) : null
406+
defined('SOCKET_EPIPE') ? (PHP_OS !== 'Darwin' || $writePending ? SOCKET_EPIPE : SOCKET_EPROTOTYPE) : null
411407
);
412408
throw $exception;
413409
}

0 commit comments

Comments
 (0)