Last active
July 2, 2021 14:30
-
-
Save randronico/f3ad3aa7cec12e53a84b12abba66137c to your computer and use it in GitHub Desktop.
Curl.php patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Curl.php b/Curl.php | |
index 651a39b..1bc1ed2 100644 | |
--- a/Curl.php | |
+++ b/Curl.php | |
@@ -365,17 +365,17 @@ class Curl | |
switch ($method) { | |
case 'GET' : | |
// Append GET params to URL | |
- $this->_url .= '?' . http_build_query($this->_params); | |
+ $this->_url .= http_build_query($this->_params) ? '?' . http_build_query($this->_params) : ''; | |
// Set options | |
- $this->options('CURLOPT_HTTPGET', 1); | |
+ $this->option('CURLOPT_HTTPGET', 1); | |
break; | |
@@ -398,29 +398,29 @@ class Curl | |
} | |
// Set timeout option if it isn't already set | |
- if (!array_key_exists('CURLOPT_TIMEOUT', $this->_options)) { | |
+ if (!array_key_exists(CURLOPT_TIMEOUT, $this->_options)) { | |
$this->option('CURLOPT_TIMEOUT', 30); | |
} | |
// Set returntransfer option if it isn't already set | |
- if (!array_key_exists('CURLOPT_RETURNTRANSFER', $this->_options)) { | |
+ if (!array_key_exists(CURLOPT_RETURNTRANSFER, $this->_options)) { | |
$this->option('CURLOPT_RETURNTRANSFER', true); | |
} | |
// Set failonerror option if it isn't already set | |
- if (!array_key_exists('CURLOPT_FAILONERROR', $this->_options)) { | |
+ if (!array_key_exists(CURLOPT_FAILONERROR, $this->_options)) { | |
$this->option('CURLOPT_FAILONERROR', true); | |
} | |
// Set user agent option if it isn't already set | |
- if (!array_key_exists('CURLOPT_USERAGENT', $this->_options)) { | |
+ if (!array_key_exists(CURLOPT_USERAGENT, $this->_options)) { | |
$this->option('CURLOPT_USERAGENT', $this->_agent); | |
} | |
// Only set follow location if not running securely | |
if (!ini_get('safe_mode') && !ini_get('open_basedir')) { | |
// Ok, follow location is not set already so lets set it to true | |
- if (!array_key_exists('CURLOPT_FOLLOWLOCATION', $this->_options)) { | |
+ if (!array_key_exists(CURLOPT_FOLLOWLOCATION, $this->_options)) { | |
$this->option('CURLOPT_FOLLOWLOCATION', true); | |
} | |
} | |
@@ -536,4 +536,4 @@ class Curl | |
return function_exists('curl_init'); | |
} | |
-} | |
\ No newline at end of file | |
+} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment