From 84909cc448583e6d609560aa757042d55ab8ae73 Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Mon, 19 Dec 2022 12:06:48 -0800 Subject: [PATCH] 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) { --- src/Curl/Curl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index 13aec16..bafd80a 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -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; }