]> git.mxchange.org Git - friendica.git/commitdiff
Improved handling of invalid links
authorMichael <heluecht@pirati.ca>
Sun, 3 Apr 2022 07:31:42 +0000 (07:31 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 3 Apr 2022 07:31:42 +0000 (07:31 +0000)
src/Util/Network.php

index 492d0ecac7293c604f5a908298ddd5b15835fa4f..7e72404287471eb815e2f8f68241f223a1833d1b 100644 (file)
@@ -569,6 +569,7 @@ class Network
         */
        public static function isValidHttpUrl(string $url)
        {
-               return in_array(parse_url($url, PHP_URL_SCHEME), ['http', 'https']) && parse_url($url, PHP_URL_HOST);
+               $scheme = parse_url($url, PHP_URL_SCHEME);
+               return !empty($scheme) && in_array($scheme, ['http', 'https']) && parse_url($url, PHP_URL_HOST);
        }
 }