Skip to content

Commit 67c144d

Browse files
happydudetvdijen
authored andcommitted
Utils\Http php 8.5 deprecation fix (simplesamlphp#2585)
* Fix php 8.5 deprecation Deprecated: The predefined locally scoped $http_response_header variable is deprecated * Fix php 8.5 deprecation Deprecated: The predefined locally scoped $http_response_header variable is deprecated
1 parent 4398438 commit 67c144d

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/SimpleSAML/Utils/HTTP.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,14 @@ public function fetch(string $url, array $context = [], bool $getHeaders = false
510510

511511
// data and headers
512512
if ($getHeaders) {
513-
if (!empty($http_response_header)) {
513+
if (PHP_VERSION_ID > 80500) {
514+
$http_response_headers = http_get_last_response_headers();
515+
} else {
516+
$http_response_headers = $http_response_header ?? [];
517+
}
518+
if (!empty($http_response_headers)) {
514519
$headers = [];
515-
foreach ($http_response_header as $h) {
520+
foreach ($http_response_headers as $h) {
516521
if (preg_match('@^HTTP/1\.[01]\s+\d{3}\s+@', $h)) {
517522
$headers = []; // reset
518523
$headers[0] = $h;

0 commit comments

Comments
 (0)