From 86f9ec22d32a9959a125cba6f12a85203afd4f2d Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Mon, 23 Feb 2026 12:10:25 +0100 Subject: [PATCH 1/2] Test PHP 8.5 too --- .github/workflows/tests.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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: - From ab67ce02bd88f777d8b26ae803c058188f92fe1d Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Mon, 23 Feb 2026 12:18:38 +0100 Subject: [PATCH 2/2] Use http_get_last_response_headers() instead of $http_response_header with PHP 8.4+ --- bin/import-cldr-data | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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}"); }