Skip to content

Commit a5dc1b2

Browse files
authored
Test PHP 8.5 too (#65)
* Test PHP 8.5 too * Use http_get_last_response_headers() instead of $http_response_header with PHP 8.4+
1 parent f4a0ad2 commit a5dc1b2

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

.github/workflows/tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
name: Setup PHP
2626
uses: shivammathur/setup-php@v2
2727
with:
28-
php-version: "8.1"
28+
php-version: "8.5"
2929
extensions: mbstring, zip
3030
tools: composer:2, php-cs-fixer:3
3131
coverage: none
@@ -43,7 +43,7 @@ jobs:
4343
matrix:
4444
php-version:
4545
- "5.3"
46-
- "8.4"
46+
- "8.5"
4747
steps:
4848
-
4949
name: Setup PHP
@@ -91,13 +91,14 @@ jobs:
9191
- "8.2"
9292
- "8.3"
9393
- "8.4"
94+
- "8.5"
9495
include:
9596
- os: windows-latest
9697
php-version: "5.6"
9798
- os: windows-latest
9899
php-version: "7.4"
99100
- os: windows-latest
100-
php-version: "8.4"
101+
php-version: "8.5"
101102
runs-on: ${{ matrix.os }}
102103
steps:
103104
-

bin/import-cldr-data

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,24 @@ class DocumentStorage
173173
private function fetch($path)
174174
{
175175
$url = $this->baseUrl . '/' . ltrim($path, '/');
176+
if (defined('PHP_VERSION_ID') && \PHP_VERSION_ID >= 80400) {
177+
http_clear_last_response_headers();
178+
}
176179
set_error_handler(function () {}, -1);
177180
$content = file_get_contents($url, false, $this->context);
178181
restore_error_handler();
179182
if ($content === false) {
180183
$details = '';
181-
/** @var array $http_response_header */
182-
if (!empty($http_response_header)) {
183-
$details = " - {$http_response_header[0]}";
184+
if (defined('PHP_VERSION_ID') && \PHP_VERSION_ID >= 80400) {
185+
$lastResponseHeaders = http_get_last_response_headers();
186+
} elseif (!empty($http_response_header)) {
187+
$varName = 'http_response_header';
188+
$lastResponseHeaders = ${$varName};
189+
} else {
190+
$lastResponseHeaders = null;
191+
}
192+
if (!empty($lastResponseHeaders)) {
193+
$details = " - {$lastResponseHeaders[0]}";
184194
}
185195
throw new RuntimeException("Failed to download from {$url}{$details}");
186196
}

0 commit comments

Comments
 (0)