Add logging to rare condition in Model\Profile::sidebar

- Adresses https://github.com/friendica/friendica/issues/8475#issuecomment-647104375
This commit is contained in:
Hypolite Petovan 2020-06-24 09:56:11 -04:00
parent 7fd2c00171
commit 192576f01a
1 changed files with 3 additions and 4 deletions

View File

@ -258,7 +258,7 @@ class Profile
* @hooks 'profile_sidebar' * @hooks 'profile_sidebar'
* array $arr * array $arr
*/ */
private static function sidebar(App $a, $profile, $block = 0, $show_connect = true) private static function sidebar(App $a, array $profile, $block = 0, $show_connect = true)
{ {
$o = ''; $o = '';
$location = false; $location = false;
@ -266,7 +266,8 @@ class Profile
// This function can also use contact information in $profile // This function can also use contact information in $profile
$is_contact = !empty($profile['cid']); $is_contact = !empty($profile['cid']);
if (!is_array($profile) && !count($profile)) { if (empty($profile['nickname'])) {
Logger::warning('Received profile with no nickname', ['profile' => $profile, 'callstack' => System::callstack(10)]);
return $o; return $o;
} }
@ -291,8 +292,6 @@ class Profile
$subscribe_feed_link = null; $subscribe_feed_link = null;
$wallmessage_link = null; $wallmessage_link = null;
$visitor_contact = []; $visitor_contact = [];
if (!empty($profile['uid']) && self::getMyURL()) { if (!empty($profile['uid']) && self::getMyURL()) {
$visitor_contact = Contact::selectFirst(['rel'], ['uid' => $profile['uid'], 'nurl' => Strings::normaliseLink(self::getMyURL())]); $visitor_contact = Contact::selectFirst(['rel'], ['uid' => $profile['uid'], 'nurl' => Strings::normaliseLink(self::getMyURL())]);