Skip to content

Commit 4bc9e8c

Browse files
committed
fix: 🐛 Warning http_response_header deprecated
Replaces http_response_header with http_get_last_response_headers ✅ Closes: #18
1 parent df4d0e2 commit 4bc9e8c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/AbstractGeocoder.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,11 @@ protected function getJSONByFopen($query)
6767
error_clear_last();
6868

6969
$ret = @file_get_contents($query);
70-
7170
if ($ret === false) {
72-
/** NOTE: https://github.com/phpstan/phpstan/issues/3213 */
73-
/** @phpstan-ignore-next-line */
74-
if (isset($http_response_header) && is_array($http_response_header)) {
75-
$error_message = $http_response_header[0];
71+
$response_headers = function_exists('http_get_last_response_headers') ? http_get_last_response_headers() : (isset($http_response_header) ? $http_response_header : null);
72+
73+
if (isset($response_headers) && is_array($response_headers)) {
74+
$error_message = $response_headers[0];
7675
if ($error = error_get_last()) {
7776
$error_message = $error['message'];
7877
}

0 commit comments

Comments
 (0)