Skip to content

Commit 6c81866

Browse files
committed
fix: specify checking againts
1 parent ab3d41b commit 6c81866

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

system/HTTP/CURLRequest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public function send(string $method, string $url)
356356
// Reset our curl options so we're on a fresh slate.
357357
$curlOptions = [];
358358

359-
if (array_key_exists('query', $this->config) && $this->config['query'] && is_array($this->config['query'])) {
359+
if (array_key_exists('query', $this->config) && is_array($this->config['query']) && $this->config['query'] !== []) {
360360
// This is likely too naive a solution.
361361
// Should look into handling when $url already
362362
// has query vars on it.
@@ -518,10 +518,10 @@ protected function setResponseHeaders(array $headers = [])
518518
protected function setCURLOptions(array $curlOptions = [], array $config = [])
519519
{
520520
// Auth Headers
521-
if (array_key_exists('auth', $config) && $config['auth']) {
521+
if (array_key_exists('auth', $config) && is_array($config['auth']) && $config['auth'] !== []) {
522522
$curlOptions[CURLOPT_USERPWD] = $config['auth'][0] . ':' . $config['auth'][1];
523523

524-
if (array_key_exists(2, $config['auth']) && $config['auth'][2] && strtolower($config['auth'][2]) === 'digest') {
524+
if (isset($this->config['auth'][2]) && $this->config['auth'][2] === 'digest') {
525525
$curlOptions[CURLOPT_HTTPAUTH] = CURLAUTH_DIGEST;
526526
} else {
527527
$curlOptions[CURLOPT_HTTPAUTH] = CURLAUTH_BASIC;
@@ -621,7 +621,7 @@ protected function setCURLOptions(array $curlOptions = [], array $config = [])
621621
$curlOptions[CURLOPT_CONNECTTIMEOUT_MS] = (float) $config['connect_timeout'] * 1000;
622622

623623
// Post Data - application/x-www-form-urlencoded
624-
if (array_key_exists('form_params', $config) && $config['form_params'] && is_array($config['form_params'])) {
624+
if (array_key_exists('form_params', $config) && is_array($config['form_params']) && $config['form_params'] !== []) {
625625
$postFields = http_build_query($config['form_params']);
626626
$curlOptions[CURLOPT_POSTFIELDS] = $postFields;
627627

@@ -632,7 +632,7 @@ protected function setCURLOptions(array $curlOptions = [], array $config = [])
632632
}
633633

634634
// Post Data - multipart/form-data
635-
if (array_key_exists('multipart', $config) && $config['multipart'] && is_array($config['multipart'])) {
635+
if (array_key_exists('multipart', $config) && is_array($config['multipart']) && $config['multipart'] !== []) {
636636
// setting the POSTFIELDS option automatically sets multipart
637637
$curlOptions[CURLOPT_POSTFIELDS] = $config['multipart'];
638638
}

0 commit comments

Comments
 (0)