diff --git a/library/Requests.php b/library/Requests.php index 916014d19..e61a8e702 100644 --- a/library/Requests.php +++ b/library/Requests.php @@ -604,7 +604,7 @@ protected static function set_defaults(&$url, &$headers, &$data, &$type, &$optio $type = strtoupper($type); if (!isset($options['data_format'])) { - if (in_array($type, array(self::HEAD, self::GET, self::DELETE))) { + if (in_array($type, array(self::HEAD, self::GET, self::DELETE), true)) { $options['data_format'] = 'query'; } else { @@ -865,7 +865,7 @@ public static function decompress($data) { public static function compatible_gzinflate($gzData) { // Compressed data might contain a full zlib header, if so strip it for // gzinflate() - if (substr($gzData, 0, 3) == "\x1f\x8b\x08") { + if (substr($gzData, 0, 3) === "\x1f\x8b\x08") { $i = 10; $flg = ord(substr($gzData, 3, 1)); if ($flg > 0) { @@ -905,7 +905,7 @@ public static function compatible_gzinflate($gzData) { // First 2 bytes should be divisible by 0x1F list(, $first_two_bytes) = unpack('n', $gzData); - if (0x08 == $first_nibble && 0 == ($first_two_bytes % 0x1F)) { + if (0x08 === $first_nibble && 0 === ($first_two_bytes % 0x1F)) { $huffman_encoded = true; } @@ -915,7 +915,7 @@ public static function compatible_gzinflate($gzData) { } } - if ("\x50\x4b\x03\x04" == substr($gzData, 0, 4)) { + if ("\x50\x4b\x03\x04" === substr($gzData, 0, 4)) { // ZIP file format header // Offset 6: 2 bytes, General-purpose field // Offset 26: 2 bytes, filename length @@ -927,7 +927,7 @@ public static function compatible_gzinflate($gzData) { // If the file has been compressed on the fly, 0x08 bit is set of // the general purpose field. We can use this to differentiate // between a compressed document, and a ZIP file - $zip_compressed_on_the_fly = (0x08 == (0x08 & $general_purpose_flag)); + $zip_compressed_on_the_fly = (0x08 === (0x08 & $general_purpose_flag)); if (!$zip_compressed_on_the_fly) { // Don't attempt to decode a compressed zip file diff --git a/library/Requests/Proxy/HTTP.php b/library/Requests/Proxy/HTTP.php index 1f163269a..25bb95a94 100644 --- a/library/Requests/Proxy/HTTP.php +++ b/library/Requests/Proxy/HTTP.php @@ -59,10 +59,10 @@ public function __construct($args = null) { $this->proxy = $args; } elseif (is_array($args)) { - if (count($args) == 1) { + if (count($args) === 1) { list($this->proxy) = $args; } - elseif (count($args) == 3) { + elseif (count($args) === 3) { list($this->proxy, $this->user, $this->pass) = $args; $this->use_authentication = true; } diff --git a/library/Requests/Response.php b/library/Requests/Response.php index 3152fb6dc..11a372f0e 100644 --- a/library/Requests/Response.php +++ b/library/Requests/Response.php @@ -97,7 +97,7 @@ public function __construct() { */ public function is_redirect() { $code = $this->status_code; - return in_array($code, array(300, 301, 302, 303, 307)) || $code > 307 && $code < 400; + return in_array($code, array(300, 301, 302, 303, 307), true) || $code > 307 && $code < 400; } /** diff --git a/library/Requests/Transport/fsockopen.php b/library/Requests/Transport/fsockopen.php index ce25ac2a4..acfe424ba 100644 --- a/library/Requests/Transport/fsockopen.php +++ b/library/Requests/Transport/fsockopen.php @@ -222,7 +222,7 @@ public function request($url, $headers = array(), $data = array(), $options = ar } $timeout_sec = (int) floor($options['timeout']); - if ($timeout_sec == $options['timeout']) { + if ($timeout_sec === $options['timeout']) { $timeout_msec = 0; } else {