Skip to content

Commit 84909cc

Browse files
committed
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) {
1 parent a0c5980 commit 84909cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Curl/Curl.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2178,7 +2178,7 @@ private function parseResponseHeaders($raw_response_headers)
21782178
$response_header_array = explode("\r\n\r\n", $raw_response_headers);
21792179
$response_header = '';
21802180
for ($i = count($response_header_array) - 1; $i >= 0; $i--) {
2181-
if (stripos($response_header_array[$i], 'HTTP/') === 0) {
2181+
if (isset($response_header_array[$i]) && stripos($response_header_array[$i], 'HTTP/') === 0) {
21822182
$response_header = $response_header_array[$i];
21832183
break;
21842184
}

0 commit comments

Comments
 (0)