Merge pull request #301 from zachborboa/comparison

Require using identical comparison operators
This commit is contained in:
Zach Borboa
2016-02-05 20:11:16 -08:00
6 changed files with 15 additions and 8 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ class Flickr
{
$oauth_data = $this->getOAuthParameters();
$oauth_data['oauth_callback'] = implode('', array(
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http',
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
'://',
$_SERVER['SERVER_NAME'],
$_SERVER['SCRIPT_NAME'],
+2 -2
View File
@@ -18,7 +18,7 @@ if (isset($_GET['code'])) {
'client_id' => CLIENT_ID,
'client_secret' => CLIENT_SECRET,
'redirect_uri' => implode('', array(
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http',
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
'://',
$_SERVER['SERVER_NAME'],
$_SERVER['SCRIPT_NAME'],
@@ -65,7 +65,7 @@ if (isset($_GET['code'])) {
$curl->get('https://accounts.google.com/o/oauth2/auth', array(
'scope' => 'https://www.googleapis.com/auth/gmail.compose',
'redirect_uri' => implode('', array(
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http',
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
'://',
$_SERVER['SERVER_NAME'],
$_SERVER['SCRIPT_NAME'],
+2 -2
View File
@@ -18,7 +18,7 @@ if (isset($_GET['code'])) {
'client_id' => CLIENT_ID,
'client_secret' => CLIENT_SECRET,
'redirect_uri' => implode('', array(
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http',
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
'://',
$_SERVER['SERVER_NAME'],
$_SERVER['SCRIPT_NAME'],
@@ -52,7 +52,7 @@ if (isset($_GET['code'])) {
$curl->get('https://accounts.google.com/o/oauth2/auth', array(
'scope' => 'https://www.googleapis.com/auth/plus.me',
'redirect_uri' => implode('', array(
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http',
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
'://',
$_SERVER['SERVER_NAME'],
$_SERVER['SCRIPT_NAME'],
+1 -1
View File
@@ -9,7 +9,7 @@ define('INSTAGRAM_CLIENT_SECRET', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
session_start();
$redirect_uri = implode('', array(
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http',
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
'://',
$_SERVER['SERVER_NAME'],
$_SERVER['SCRIPT_NAME'],
+2 -2
View File
@@ -36,7 +36,7 @@ if ($request_method === 'POST') {
$test = isset($_SERVER['HTTP_X_DEBUG_TEST']) ? $_SERVER['HTTP_X_DEBUG_TEST'] : '';
$key = isset($data_values['key']) ? $data_values['key'] : '';
if ($test == 'http_basic_auth') {
if ($test === 'http_basic_auth') {
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
@@ -50,7 +50,7 @@ if ($test == 'http_basic_auth') {
'password' => $_SERVER['PHP_AUTH_PW'],
));
exit;
} elseif ($test == 'http_digest_auth') {
} elseif ($test === 'http_digest_auth') {
$users = array(
'myusername' => 'mypassword',
);
+7
View File
@@ -84,3 +84,10 @@ if [[ ! -z "${caps}" ]]; then
echo -e "${caps}" | perl -pe 's/^(.*)$/All caps found in \1/'
exit 1
fi
# Require identical comparison operators (===, not ==) in php files.
equal=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec egrep --color=always --line-number -H "[^!=]==[^=]" {} \;)
if [[ ! -z "${equal}" ]]; then
echo -e "${equal}" | perl -pe 's/^(.*)$/Non-identical comparison operator found in \1/'
exit 1
fi