From 132e7a3afa26c9d257e9686abda4e9b13c5decd3 Mon Sep 17 00:00:00 2001 From: Stefan Giehl Date: Tue, 15 Oct 2024 16:25:22 +0200 Subject: [PATCH 1/2] Provide enclosure character for str_getcsv With PHP 8.4 `str_getcsv` will require a single character to be provided as enclosure. Passing an empty string results in ``` ValueError: str_getcsv(): Argument #3 ($enclosure) must be a single character ``` --- BlockedIpRanges/DigitalOcean.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BlockedIpRanges/DigitalOcean.php b/BlockedIpRanges/DigitalOcean.php index 968f9c6..a450b94 100644 --- a/BlockedIpRanges/DigitalOcean.php +++ b/BlockedIpRanges/DigitalOcean.php @@ -26,7 +26,7 @@ public function getRanges(): array return []; } - $digitalOcean = str_getcsv($digitalOcean['data'], ',', ''); + $digitalOcean = str_getcsv($digitalOcean['data'], ',', '"'); if (empty($digitalOcean)) { throw new \Exception('Failed to parse digital ocean IP ranges'); From 5cb92997ed76006a153d2b75e796b38749bb0f34 Mon Sep 17 00:00:00 2001 From: Jacob Ransom Date: Thu, 17 Oct 2024 11:40:14 +1300 Subject: [PATCH 2/2] Updating function call to use default arguments --- BlockedIpRanges/DigitalOcean.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BlockedIpRanges/DigitalOcean.php b/BlockedIpRanges/DigitalOcean.php index a450b94..1c3c956 100644 --- a/BlockedIpRanges/DigitalOcean.php +++ b/BlockedIpRanges/DigitalOcean.php @@ -26,7 +26,7 @@ public function getRanges(): array return []; } - $digitalOcean = str_getcsv($digitalOcean['data'], ',', '"'); + $digitalOcean = str_getcsv($digitalOcean['data']); if (empty($digitalOcean)) { throw new \Exception('Failed to parse digital ocean IP ranges');