From 0a3f6028959b8d22a2c4478707ef8f26946073c9 Mon Sep 17 00:00:00 2001 From: Andy Postnikov Date: Wed, 27 Aug 2025 12:26:54 +0200 Subject: [PATCH 1/2] Fix PHP 8.5 deprecation https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_the_http_response_header_predefined_variable --- src/JsonSchema/Uri/Retrievers/FileGetContents.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/JsonSchema/Uri/Retrievers/FileGetContents.php b/src/JsonSchema/Uri/Retrievers/FileGetContents.php index 18fb7fcf..bebdf5c7 100644 --- a/src/JsonSchema/Uri/Retrievers/FileGetContents.php +++ b/src/JsonSchema/Uri/Retrievers/FileGetContents.php @@ -51,6 +51,9 @@ public function retrieve($uri) } $this->messageBody = $response; + if (function_exists('http_get_last_response_headers')) { + $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. From a6319ce75b8be2bac7c5945ac8b0368ef22dd958 Mon Sep 17 00:00:00 2001 From: Andy Postnikov Date: Wed, 27 Aug 2025 22:47:57 +0200 Subject: [PATCH 2/2] add code comment about BC --- src/JsonSchema/Uri/Retrievers/FileGetContents.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/JsonSchema/Uri/Retrievers/FileGetContents.php b/src/JsonSchema/Uri/Retrievers/FileGetContents.php index bebdf5c7..cfb28d6f 100644 --- a/src/JsonSchema/Uri/Retrievers/FileGetContents.php +++ b/src/JsonSchema/Uri/Retrievers/FileGetContents.php @@ -52,6 +52,8 @@ 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)) {