Skip to content

Commit 05da0a4

Browse files
committed
Merge pull request php-curl-class#301 from zachborboa/comparison
Require using identical comparison operators
2 parents 98c9d8f + 93d088f commit 05da0a4

File tree

6 files changed

+15
-8
lines changed

6 files changed

+15
-8
lines changed

examples/flickr.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private function getRequestToken()
7474
{
7575
$oauth_data = $this->getOAuthParameters();
7676
$oauth_data['oauth_callback'] = implode('', array(
77-
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http',
77+
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
7878
'://',
7979
$_SERVER['SERVER_NAME'],
8080
$_SERVER['SCRIPT_NAME'],

examples/gmail_send_email.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
'client_id' => CLIENT_ID,
1919
'client_secret' => CLIENT_SECRET,
2020
'redirect_uri' => implode('', array(
21-
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http',
21+
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
2222
'://',
2323
$_SERVER['SERVER_NAME'],
2424
$_SERVER['SCRIPT_NAME'],
@@ -65,7 +65,7 @@
6565
$curl->get('https://accounts.google.com/o/oauth2/auth', array(
6666
'scope' => 'https://www.googleapis.com/auth/gmail.compose',
6767
'redirect_uri' => implode('', array(
68-
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http',
68+
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
6969
'://',
7070
$_SERVER['SERVER_NAME'],
7171
$_SERVER['SCRIPT_NAME'],

examples/google_plus_profile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
'client_id' => CLIENT_ID,
1919
'client_secret' => CLIENT_SECRET,
2020
'redirect_uri' => implode('', array(
21-
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http',
21+
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
2222
'://',
2323
$_SERVER['SERVER_NAME'],
2424
$_SERVER['SCRIPT_NAME'],
@@ -52,7 +52,7 @@
5252
$curl->get('https://accounts.google.com/o/oauth2/auth', array(
5353
'scope' => 'https://www.googleapis.com/auth/plus.me',
5454
'redirect_uri' => implode('', array(
55-
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http',
55+
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
5656
'://',
5757
$_SERVER['SERVER_NAME'],
5858
$_SERVER['SCRIPT_NAME'],

examples/instagram_popular_media.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
session_start();
1010

1111
$redirect_uri = implode('', array(
12-
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http',
12+
isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http',
1313
'://',
1414
$_SERVER['SERVER_NAME'],
1515
$_SERVER['SCRIPT_NAME'],

tests/PHPCurlClass/server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
$test = isset($_SERVER['HTTP_X_DEBUG_TEST']) ? $_SERVER['HTTP_X_DEBUG_TEST'] : '';
3737
$key = isset($data_values['key']) ? $data_values['key'] : '';
3838

39-
if ($test == 'http_basic_auth') {
39+
if ($test === 'http_basic_auth') {
4040
if (!isset($_SERVER['PHP_AUTH_USER'])) {
4141
header('WWW-Authenticate: Basic realm="My Realm"');
4242
header('HTTP/1.0 401 Unauthorized');
@@ -50,7 +50,7 @@
5050
'password' => $_SERVER['PHP_AUTH_PW'],
5151
));
5252
exit;
53-
} elseif ($test == 'http_digest_auth') {
53+
} elseif ($test === 'http_digest_auth') {
5454
$users = array(
5555
'myusername' => 'mypassword',
5656
);

tests/script.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,10 @@ if [[ ! -z "${caps}" ]]; then
8484
echo -e "${caps}" | perl -pe 's/^(.*)$/All caps found in \1/'
8585
exit 1
8686
fi
87+
88+
# Require identical comparison operators (===, not ==) in php files.
89+
equal=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec egrep --color=always --line-number -H "[^!=]==[^=]" {} \;)
90+
if [[ ! -z "${equal}" ]]; then
91+
echo -e "${equal}" | perl -pe 's/^(.*)$/Non-identical comparison operator found in \1/'
92+
exit 1
93+
fi

0 commit comments

Comments
 (0)