mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-19 15:35:52 +00:00
utils: avoid weak comparisons
This commit is contained in:
parent
97c5902ae2
commit
0358b7dce4
@ -100,7 +100,7 @@ class Internet{
|
||||
}
|
||||
|
||||
$ip = self::getURL("http://ifconfig.me/ip");
|
||||
if($ip !== null && ($addr = trim($ip->getBody())) != ""){
|
||||
if($ip !== null && ($addr = trim($ip->getBody())) !== ""){
|
||||
return self::$ip = $addr;
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ abstract class Timezone{
|
||||
|
||||
$offset = $matches[2];
|
||||
|
||||
if($offset == ""){
|
||||
if($offset === ""){
|
||||
return "UTC";
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ abstract class Timezone{
|
||||
|
||||
$offset = trim(exec('date +%:z'));
|
||||
|
||||
if($offset == "+00:00"){
|
||||
if($offset === "+00:00"){
|
||||
return "UTC";
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ abstract class Timezone{
|
||||
$offset = $parsed['hour'] * 3600 + $parsed['minute'] * 60 + $parsed['second'];
|
||||
|
||||
//After date_parse is done, put the sign back
|
||||
if($negative_offset == true){
|
||||
if($negative_offset){
|
||||
$offset = -abs($offset);
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ abstract class Timezone{
|
||||
//That's been a bug in PHP since 2008!
|
||||
foreach(timezone_abbreviations_list() as $zones){
|
||||
foreach($zones as $timezone){
|
||||
if($timezone['timezone_id'] !== null && $timezone['offset'] == $offset){
|
||||
if($timezone['timezone_id'] !== null && $timezone['offset'] === $offset){
|
||||
return $timezone['timezone_id'];
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ final class Utils{
|
||||
$mac = implode("\n", $mac);
|
||||
if(preg_match_all("#Physical Address[. ]{1,}: ([0-9A-F\\-]{17})#", $mac, $matches) > 0){
|
||||
foreach($matches[1] as $i => $v){
|
||||
if($v == "00-00-00-00-00-00"){
|
||||
if($v === "00-00-00-00-00-00"){
|
||||
unset($matches[1][$i]);
|
||||
}
|
||||
}
|
||||
@ -234,7 +234,7 @@ final class Utils{
|
||||
$mac = implode("\n", $mac);
|
||||
if(preg_match_all("#HWaddr[ \t]{1,}([0-9a-f:]{17})#", $mac, $matches) > 0){
|
||||
foreach($matches[1] as $i => $v){
|
||||
if($v == "00:00:00:00:00:00"){
|
||||
if($v === "00:00:00:00:00:00"){
|
||||
unset($matches[1][$i]);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user