diff --git a/src/JsonSchema/Uri/Retrievers/FileGetContents.php b/src/JsonSchema/Uri/Retrievers/FileGetContents.php index 18fb7fcf..cfb28d6f 100644 --- a/src/JsonSchema/Uri/Retrievers/FileGetContents.php +++ b/src/JsonSchema/Uri/Retrievers/FileGetContents.php @@ -51,6 +51,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.