diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8758e88..895ad8c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -25,7 +25,7 @@ jobs: name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: "8.1" + php-version: "8.5" extensions: mbstring, zip tools: composer:2, php-cs-fixer:3 coverage: none @@ -43,7 +43,7 @@ jobs: matrix: php-version: - "5.3" - - "8.4" + - "8.5" steps: - name: Setup PHP @@ -91,13 +91,14 @@ jobs: - "8.2" - "8.3" - "8.4" + - "8.5" include: - os: windows-latest php-version: "5.6" - os: windows-latest php-version: "7.4" - os: windows-latest - php-version: "8.4" + php-version: "8.5" runs-on: ${{ matrix.os }} steps: - diff --git a/bin/import-cldr-data b/bin/import-cldr-data index db6d2fa..990f5a8 100755 --- a/bin/import-cldr-data +++ b/bin/import-cldr-data @@ -173,14 +173,24 @@ class DocumentStorage private function fetch($path) { $url = $this->baseUrl . '/' . ltrim($path, '/'); + if (defined('PHP_VERSION_ID') && \PHP_VERSION_ID >= 80400) { + http_clear_last_response_headers(); + } set_error_handler(function () {}, -1); $content = file_get_contents($url, false, $this->context); restore_error_handler(); if ($content === false) { $details = ''; - /** @var array $http_response_header */ - if (!empty($http_response_header)) { - $details = " - {$http_response_header[0]}"; + if (defined('PHP_VERSION_ID') && \PHP_VERSION_ID >= 80400) { + $lastResponseHeaders = http_get_last_response_headers(); + } elseif (!empty($http_response_header)) { + $varName = 'http_response_header'; + $lastResponseHeaders = ${$varName}; + } else { + $lastResponseHeaders = null; + } + if (!empty($lastResponseHeaders)) { + $details = " - {$lastResponseHeaders[0]}"; } throw new RuntimeException("Failed to download from {$url}{$details}"); }