Merge pull request #8863 from MrPetovan/bug/notices

Address various notices still
This commit is contained in:
Michael Vogel 2020-07-11 18:47:48 +02:00 committed by GitHub
commit 7f515cdaa4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 5 deletions

View file

@ -79,7 +79,7 @@ function salmon_post(App $a, $xml = '') {
// stash away some other stuff for later // stash away some other stuff for later
$type = $base->data[0]->attributes()->type[0]; $type = $base->data[0]->attributes()->type[0];
$keyhash = $base->sig[0]->attributes()->keyhash[0]; $keyhash = $base->sig[0]->attributes()->keyhash[0] ?? '';
$encoding = $base->encoding; $encoding = $base->encoding;
$alg = $base->alg; $alg = $base->alg;

View file

@ -187,7 +187,7 @@ class Nav
'name' => $a->user['username'], 'name' => $a->user['username'],
]; ];
} else { } else {
DI::logger()->warning('Empty $a->user for local user'. ['local_user' => local_user(), '$a' => $a]); DI::logger()->warning('Empty $a->user for local user', ['local_user' => local_user(), '$a' => $a]);
} }
} }
@ -256,7 +256,7 @@ class Nav
} }
// The following nav links are only show to logged in users // The following nav links are only show to logged in users
if (local_user()) { if (local_user() && !empty($a->user)) {
$nav['network'] = ['network', DI::l10n()->t('Network'), '', DI::l10n()->t('Conversations from your friends')]; $nav['network'] = ['network', DI::l10n()->t('Network'), '', DI::l10n()->t('Conversations from your friends')];
$nav['home'] = ['profile/' . $a->user['nickname'], DI::l10n()->t('Home'), '', DI::l10n()->t('Your posts and conversations')]; $nav['home'] = ['profile/' . $a->user['nickname'], DI::l10n()->t('Home'), '', DI::l10n()->t('Your posts and conversations')];

View file

@ -1077,7 +1077,6 @@ class Contact
} }
if (DBA::isResult($r)) { if (DBA::isResult($r)) {
$authoritativeResult = true;
// If there is more than one entry we filter out the connector networks // If there is more than one entry we filter out the connector networks
if (count($r) > 1) { if (count($r) > 1) {
foreach ($r as $id => $result) { foreach ($r as $id => $result) {
@ -1088,7 +1087,10 @@ class Contact
} }
$profile = array_shift($r); $profile = array_shift($r);
}
if (!empty($profile)) {
$authoritativeResult = true;
// "bd" always contains the upcoming birthday of a contact. // "bd" always contains the upcoming birthday of a contact.
// "birthday" might contain the birthday including the year of birth. // "birthday" might contain the birthday including the year of birth.
if ($profile["birthday"] > DBA::NULL_DATE) { if ($profile["birthday"] > DBA::NULL_DATE) {

View file

@ -59,7 +59,7 @@ class Fetch extends BaseModule
if (empty($item)) { if (empty($item)) {
$condition = ['guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]]; $condition = ['guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
$item = Item::selectFirst(['author-link'], $condition); $item = Item::selectFirst(['author-link'], $condition);
if (empty($item)) { if (!empty($item["author-link"])) {
$parts = parse_url($item["author-link"]); $parts = parse_url($item["author-link"]);
if (empty($parts["scheme"]) || empty($parts["host"])) { if (empty($parts["scheme"]) || empty($parts["host"])) {
throw new HTTPException\InternalServerErrorException(); throw new HTTPException\InternalServerErrorException();

View file

@ -79,6 +79,11 @@ class Acl extends BaseModule
$contacts = []; $contacts = [];
foreach ($r as $g) { foreach ($r as $g) {
if (empty($g['name'])) {
DI::logger()->warning('Wrong result item from Search::searchGlobalContact', ['$g' => $g, '$search' => $search, '$mode' => $mode, '$page' => $page]);
continue;
}
$contacts[] = [ $contacts[] = [
'photo' => ProxyUtils::proxifyUrl($g['photo'], false, ProxyUtils::SIZE_MICRO), 'photo' => ProxyUtils::proxifyUrl($g['photo'], false, ProxyUtils::SIZE_MICRO),
'name' => htmlspecialchars($g['name']), 'name' => htmlspecialchars($g['name']),