Skip to content

Commit b5a44b6

Browse files
authored
Fix PHP 8.5 $http_response_header deprecation on 5.x.x (#857)
As requested in #841 (comment)
1 parent feb2ca6 commit b5a44b6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/JsonSchema/Uri/Retrievers/FileGetContents.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ public function retrieve($uri)
4949
}
5050

5151
$this->messageBody = $response;
52+
if (function_exists('http_get_last_response_headers')) {
53+
// Use http_get_last_response_headers() for BC compatibility with PHP 8.5+
54+
// where $http_response_header is deprecated.
55+
$http_response_header = http_get_last_response_headers();
56+
}
5257
if (!empty($http_response_header)) {
5358
// $http_response_header cannot be tested, because it's defined in the method's local scope
5459
// See http://php.net/manual/en/reserved.variables.httpresponseheader.php for more info.

0 commit comments

Comments
 (0)