Commit 0330bad6 authored by Brion Vibber's avatar Brion Vibber

Cleaner code to avoid a couple PHP notices from accessing uninitialized...

Cleaner code to avoid a couple PHP notices from accessing uninitialized variables in ostatus profile discovery (these cases hit checking diaspora accounts)
parent 6c671141
......@@ -1552,8 +1552,11 @@ class Ostatus_profile extends Memcached_DataObject
}
// Try the profile url (like foo.example.com or example.com/user/foo)
$profileUrl = ($object->link) ? $object->link : $hints['profileurl'];
if (!empty($object->link)) {
$profileUrl = $object->link;
} else if (!empty($hints['profileurl'])) {
$profileUrl = $hints['profileurl'];
}
if (!empty($profileUrl)) {
$nickname = self::nicknameFromURI($profileUrl);
......@@ -1584,9 +1587,11 @@ class Ostatus_profile extends Memcached_DataObject
protected static function nicknameFromURI($uri)
{
preg_match('/(\w+):/', $uri, $matches);
$protocol = $matches[1];
if (preg_match('/(\w+):/', $uri, $matches)) {
$protocol = $matches[1];
} else {
return null;
}
switch ($protocol) {
case 'acct':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment