Fix static analysis error

Error message:
    ERROR: InvalidArrayOffset - ../src/Curl/Curl.php:2182:25 - Cannot
    access value on variable $response_header_array using a int<-1, max>
    offset, expecting int<0, max> (see https://psalm.dev/115)
            if (stripos($response_header_array[$i], 'HTTP/') === 0) {
This commit is contained in:
Zach Borboa
2022-12-19 12:06:48 -08:00
parent a0c5980cbc
commit 84909cc448
+1 -1
View File
@@ -2178,7 +2178,7 @@ class Curl
$response_header_array = explode("\r\n\r\n", $raw_response_headers);
$response_header = '';
for ($i = count($response_header_array) - 1; $i >= 0; $i--) {
if (stripos($response_header_array[$i], 'HTTP/') === 0) {
if (isset($response_header_array[$i]) && stripos($response_header_array[$i], 'HTTP/') === 0) {
$response_header = $response_header_array[$i];
break;
}