From 83d29d985ebcaf84b8ed13b2244c263761ea4ede Mon Sep 17 00:00:00 2001 From: Denny Septian Panggabean Date: Sun, 1 Dec 2024 20:32:10 +0700 Subject: [PATCH] fix: using default match --- system/HTTP/CURLRequest.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/system/HTTP/CURLRequest.php b/system/HTTP/CURLRequest.php index 30da34e4be9f..3a606be97442 100644 --- a/system/HTTP/CURLRequest.php +++ b/system/HTTP/CURLRequest.php @@ -650,14 +650,12 @@ protected function setCURLOptions(array $curlOptions = [], array $config = []) } // Resolve IP - if (array_key_exists('force_ip_resolve', $config) && is_string($config['force_ip_resolve']) && $config['force_ip_resolve'] !== '') { - $protocolVersion = $config['force_ip_resolve']; - - if ($protocolVersion === 'v4') { - $curlOptions[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4; - } elseif ($protocolVersion === 'v6') { - $curlOptions[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V6; - } + if (array_key_exists('force_ip_resolve', $config)) { + $curlOptions[CURLOPT_IPRESOLVE] = match ($config['force_ip_resolve']) { + 'v4' => CURL_IPRESOLVE_V4, + 'v6' => CURL_IPRESOLVE_V6, + default => CURL_IPRESOLVE_WHATEVER + }; } // version