]> git.mxchange.org Git - friendica.git/commitdiff
Improved check for invalid profiles
authorMichael <heluecht@pirati.ca>
Sun, 5 Jan 2020 13:19:11 +0000 (13:19 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 5 Jan 2020 13:19:11 +0000 (13:19 +0000)
src/Model/UserItem.php

index 03e7f51f644fac3b23d4fdc304ed00327280b3b4..15c77300540fc4b44daca18faebb42c945b56dee 100644 (file)
@@ -148,10 +148,8 @@ class UserItem
 
                // Validate and add profile links
                foreach ($profiles AS $key => $profile) {
-                       // Check for invalid profile urls. 13 should be the shortest possible profile length:
-                       // http://a.bc/d
-                       // Additionally check for invalid urls that would return the normalised value "http:"
-                       if ((strlen($profile) < 13) || (Strings::normaliseLink($profile) == 'http:')) {
+                       // Check for invalid profile urls (without scheme, host or path) and remove them
+                       if (empty(parse_url($profile, PHP_URL_SCHEME)) || empty(parse_url($profile, PHP_URL_HOST)) || empty(parse_url($profile, PHP_URL_PATH))) {
                                unset($profiles[$key]);
                                continue;
                        }