Skip to content

Commit acd2e14

Browse files
committed
Update to require PHP 7.1+
1 parent da8ee09 commit acd2e14

22 files changed

+23
-181
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
@@ -36,19 +31,3 @@ jobs:
3631
if: ${{ matrix.php >= 7.3 }}
3732
- run: vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy
3833
if: ${{ matrix.php < 7.3 }}
39-
40-
PHPUnit-hhvm:
41-
name: PHPUnit (HHVM)
42-
runs-on: ubuntu-22.04
43-
continue-on-error: true
44-
steps:
45-
- uses: actions/checkout@v4
46-
- run: cp "$(which composer)" composer.phar && ./composer.phar self-update --2.2 # downgrade Composer for HHVM
47-
- name: Run hhvm composer.phar install
48-
uses: docker://hhvm/hhvm:3.30-lts-latest
49-
with:
50-
args: hhvm composer.phar install
51-
- name: Run hhvm vendor/bin/phpunit
52-
uses: docker://hhvm/hhvm:3.30-lts-latest
53-
with:
54-
args: hhvm vendor/bin/phpunit

README.md

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

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

29972996
## Tests

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
}
2727
],
2828
"require": {
29-
"php": ">=5.3.0",
29+
"php": ">=7.1",
3030
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
3131
"fig/http-message-util": "^1.1",
3232
"psr/http-message": "^1.0",
@@ -39,8 +39,8 @@
3939
"clue/http-proxy-react": "^1.8",
4040
"clue/reactphp-ssh-proxy": "^1.4",
4141
"clue/socks-react": "^1.4",
42-
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36",
43-
"react/async": "^4 || ^3 || ^2",
42+
"phpunit/phpunit": "^9.6 || ^5.7",
43+
"react/async": "^4 || ^3",
4444
"react/promise-stream": "^1.4",
4545
"react/promise-timer": "^1.9"
4646
},

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/Io/ClientRequestStream.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ private function writeHead()
6969
}
7070
}
7171

72-
/** @var array $m legacy PHP 5.3 only */
73-
if (!\preg_match('#^\S+ \S+ HTTP/1\.[01]\r\n#m', $headers) || \substr_count($headers, "\n") !== ($expected + 1) || (\PHP_VERSION_ID >= 50400 ? \preg_match_all(AbstractMessage::REGEX_HEADERS, $headers) : \preg_match_all(AbstractMessage::REGEX_HEADERS, $headers, $m)) !== $expected) {
72+
if (!\preg_match('#^\S+ \S+ HTTP/1\.[01]\r\n#m', $headers) || \substr_count($headers, "\n") !== ($expected + 1) || \preg_match_all(AbstractMessage::REGEX_HEADERS, $headers) !== $expected) {
7473
$this->closeError(new \InvalidArgumentException('Unable to send request with invalid request headers'));
7574
return;
7675
}

src/Io/MultipartParser.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ final class MultipartParser
3636
/**
3737
* ini setting "max_input_vars"
3838
*
39-
* Does not exist in PHP < 5.3.9 or HHVM, so assume PHP's default 1000 here.
39+
* Assume PHP' default of 1000 here.
4040
*
4141
* @var int
4242
* @link http://php.net/manual/en/info.configuration.php#ini.max-input-vars
@@ -46,7 +46,7 @@ final class MultipartParser
4646
/**
4747
* ini setting "max_input_nesting_level"
4848
*
49-
* Does not exist in HHVM, but assumes hard coded to 64 (PHP's default).
49+
* Assume PHP's default of 64 here.
5050
*
5151
* @var int
5252
* @link http://php.net/manual/en/info.configuration.php#ini.max-input-nesting-level
@@ -81,14 +81,8 @@ final class MultipartParser
8181
*/
8282
public function __construct($uploadMaxFilesize = null, $maxFileUploads = null)
8383
{
84-
$var = \ini_get('max_input_vars');
85-
if ($var !== false) {
86-
$this->maxInputVars = (int)$var;
87-
}
88-
$var = \ini_get('max_input_nesting_level');
89-
if ($var !== false) {
90-
$this->maxInputNestingLevel = (int)$var;
91-
}
84+
$this->maxInputVars = (int) \ini_get('max_input_vars');
85+
$this->maxInputNestingLevel = (int) \ini_get('max_input_nesting_level');
9286

9387
if ($uploadMaxFilesize === null) {
9488
$uploadMaxFilesize = \ini_get('upload_max_filesize');

src/Io/StreamingServer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,7 @@ public function handleResponse(ConnectionInterface $connection, ServerRequestInt
346346
}
347347
}
348348

349-
/** @var array $m legacy PHP 5.3 only */
350-
if ($code < 100 || $code > 999 || \substr_count($headers, "\n") !== ($expected + 1) || (\PHP_VERSION_ID >= 50400 ? \preg_match_all(AbstractMessage::REGEX_HEADERS, $headers) : \preg_match_all(AbstractMessage::REGEX_HEADERS, $headers, $m)) !== $expected) {
349+
if ($code < 100 || $code > 999 || \substr_count($headers, "\n") !== ($expected + 1) || \preg_match_all(AbstractMessage::REGEX_HEADERS, $headers) !== $expected) {
351350
$this->emit('error', array(new \InvalidArgumentException('Unable to send response with invalid response headers')));
352351
$this->writeError($connection, Response::STATUS_INTERNAL_SERVER_ERROR, $request);
353352
return;

src/Message/Response.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ public static function json($data)
151151
(\defined('JSON_PRETTY_PRINT') ? \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE : 0) | (\defined('JSON_PRESERVE_ZERO_FRACTION') ? \JSON_PRESERVE_ZERO_FRACTION : 0)
152152
);
153153

154-
// throw on error, now `false` but used to be `(string) "null"` before PHP 5.5
155-
if ($json === false || (\PHP_VERSION_ID < 50500 && \json_last_error() !== \JSON_ERROR_NONE)) {
154+
if ($json === false) {
156155
throw new \InvalidArgumentException(
157156
'Unable to encode given data as JSON' . (\function_exists('json_last_error_msg') ? ': ' . \json_last_error_msg() : ''),
158157
\json_last_error()

src/Message/Uri.php

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,7 @@ final class Uri implements UriInterface
4545
*/
4646
public function __construct($uri)
4747
{
48-
// @codeCoverageIgnoreStart
49-
if (\PHP_VERSION_ID < 50407 && \strpos($uri, '//') === 0) {
50-
// @link https://3v4l.org/UrAQP
51-
$parts = \parse_url('http:' . $uri);
52-
unset($parts['schema']);
53-
} else {
54-
$parts = \parse_url($uri);
55-
}
56-
// @codeCoverageIgnoreEnd
57-
48+
$parts = \parse_url($uri);
5849
if ($parts === false || (isset($parts['scheme']) && !\preg_match('#^[a-z]+$#i', $parts['scheme'])) || (isset($parts['host']) && \preg_match('#[\s_%+]#', $parts['host']))) {
5950
throw new \InvalidArgumentException('Invalid URI given');
6051
}

tests/Client/FunctionalIntegrationTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,6 @@ public function testRequestLegacyHttpServerWithOnlyLineFeedReturnsSuccessfulResp
134134
/** @group internet */
135135
public function testSuccessfulResponseEmitsEnd()
136136
{
137-
// max_nesting_level was set to 100 for PHP Versions < 5.4 which resulted in failing test for legacy PHP
138-
ini_set('xdebug.max_nesting_level', 256);
139-
140137
$client = new Client(new ClientConnectionManager(new Connector(), Loop::get()));
141138

142139
$request = $client->request(new Request('GET', 'http://www.google.com/', array(), '', '1.0'));
@@ -155,9 +152,6 @@ public function testSuccessfulResponseEmitsEnd()
155152
/** @group internet */
156153
public function testCancelPendingConnectionEmitsClose()
157154
{
158-
// max_nesting_level was set to 100 for PHP Versions < 5.4 which resulted in failing test for legacy PHP
159-
ini_set('xdebug.max_nesting_level', 256);
160-
161155
$client = new Client(new ClientConnectionManager(new Connector(), Loop::get()));
162156

163157
$request = $client->request(new Request('GET', 'http://www.google.com/', array(), '', '1.0'));

0 commit comments

Comments
 (0)