From e77a7383e76a7bf46b2ae205167f9610dc794b1a Mon Sep 17 00:00:00 2001 From: Dorian Villet Date: Sun, 7 Dec 2025 10:45:00 +0100 Subject: [PATCH] Fix PHP 8.5 $http_response_header deprecation --- src/JsonSchema/Uri/Retrievers/FileGetContents.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/JsonSchema/Uri/Retrievers/FileGetContents.php b/src/JsonSchema/Uri/Retrievers/FileGetContents.php index 7019814f..c03348bc 100644 --- a/src/JsonSchema/Uri/Retrievers/FileGetContents.php +++ b/src/JsonSchema/Uri/Retrievers/FileGetContents.php @@ -49,6 +49,11 @@ public function retrieve($uri) } $this->messageBody = $response; + if (function_exists('http_get_last_response_headers')) { + // Use http_get_last_response_headers() for BC compatibility with PHP 8.5+ + // where $http_response_header is deprecated. + $http_response_header = http_get_last_response_headers(); + } if (!empty($http_response_header)) { // $http_response_header cannot be tested, because it's defined in the method's local scope // See http://php.net/manual/en/reserved.variables.httpresponseheader.php for more info.