From 8d5653ab5ef22bc93dee0ea5e1b74a99515351c3 Mon Sep 17 00:00:00 2001 From: Matteo Trubini <7964032+matteotrubini@users.noreply.github.com> Date: Tue, 21 Apr 2026 21:47:01 +0200 Subject: [PATCH] fix(asset): migrate from $http_response_header to http_get_last_response_headers() Use http_get_last_response_headers() when available and keep $http_response_header fallback for PHP < 8.4. Comment marks the shim for removal when minimum PHP >= 8.4. --- src/Assetic/Asset/HttpAsset.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Assetic/Asset/HttpAsset.php b/src/Assetic/Asset/HttpAsset.php index 6191e79..bf8b9ba 100644 --- a/src/Assetic/Asset/HttpAsset.php +++ b/src/Assetic/Asset/HttpAsset.php @@ -58,7 +58,12 @@ public function load(?FilterInterface $additionalFilter = null) public function getLastModified() { if (false !== @file_get_contents($this->sourceUrl, false, stream_context_create(array('http' => array('method' => 'HEAD'))))) { - foreach ($http_response_header as $header) { + // TODO: $http_response_header deprecated since PHP 8.5 + // Remove when min PHP >= 8.4 and use http_get_last_response_headers() directly + $headers = function_exists('http_get_last_response_headers') + ? http_get_last_response_headers() + : $http_response_header; + foreach ($headers as $header) { if (0 === stripos($header, 'Last-Modified: ')) { list(, $mtime) = explode(':', $header, 2);