X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FNetwork.php;h=e4e9c5af5bb5a75673017425b6cc298057fa74ac;hb=58c8959da0ece9a23966b315310a3962542bc7f4;hp=b534a5505bbcf9c9b41a087a1a636684b012c178;hpb=318a3ca785474fa27fbff9b3ee19fd4c04261ecd;p=friendica.git diff --git a/src/Util/Network.php b/src/Util/Network.php index b534a5505b..e4e9c5af5b 100644 --- a/src/Util/Network.php +++ b/src/Util/Network.php @@ -838,7 +838,7 @@ class Network /** - * @brief Switch the scheme of an url between http and https + * Switch the scheme of an url between http and https * * @param string $url URL * @@ -846,15 +846,17 @@ class Network */ public static function switchScheme($url) { - $parts = parse_url($url, PHP_URL_SCHEME); - if (!isset($parts['scheme'])) { + $scheme = parse_url($url, PHP_URL_SCHEME); + if (empty($scheme)) { return $url; } - if ($parts['scheme'] == 'http') { + + if ($scheme === 'http') { $url = str_replace('http://', 'https://', $url); - } elseif ($parts['scheme'] == 'https') { + } elseif ($scheme === 'https') { $url = str_replace('https://', 'http://', $url); } + return $url; } }