From 12ed714a9e36b4248e045e6648384cb91a573477 Mon Sep 17 00:00:00 2001 From: Art4 Date: Sun, 17 Nov 2024 22:26:43 +0000 Subject: [PATCH] Fix more errors --- src/Module/Security/TwoFactor/Trust.php | 2 +- src/Module/Settings/Profile/Photo/Crop.php | 6 ------ src/Module/Xrd.php | 4 +++- .../ValueObject/FormattedNotify.php | 16 ++++++++-------- view/theme/frio/config.php | 2 +- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/Module/Security/TwoFactor/Trust.php b/src/Module/Security/TwoFactor/Trust.php index ce6b370bef..a2a40ea5e6 100644 --- a/src/Module/Security/TwoFactor/Trust.php +++ b/src/Module/Security/TwoFactor/Trust.php @@ -94,7 +94,7 @@ class Trust extends BaseModule // exception wanted! throw $e; } catch (\Exception $e) { - $this->logger->warning('Unexpected error during authentication.', ['user' => $this->session->getLocalUserId(), 'exception' => $exception]); + $this->logger->warning('Unexpected error during authentication.', ['user' => $this->session->getLocalUserId(), 'exception' => $e]); } } } diff --git a/src/Module/Settings/Profile/Photo/Crop.php b/src/Module/Settings/Profile/Photo/Crop.php index 0853b2ae6d..d18b3e862d 100644 --- a/src/Module/Settings/Profile/Photo/Crop.php +++ b/src/Module/Settings/Profile/Photo/Crop.php @@ -46,9 +46,6 @@ class Crop extends BaseSettings $base_image = Photo::selectFirst([], ['resource-id' => $resource_id, 'uid' => DI::userSession()->getLocalUserId(), 'scale' => $scale]); if (DBA::isResult($base_image)) { $Image = Photo::getImageForPhoto($base_image); - if (empty($Image)) { - throw new HTTPException\InternalServerErrorException(); - } if ($Image->isValid()) { // If setting for the default profile, unset the profile photo flag from any other photos I own @@ -185,9 +182,6 @@ class Crop extends BaseSettings } $Image = Photo::getImageForPhoto($photos[0]); - if (empty($Image)) { - throw new HTTPException\InternalServerErrorException(); - } $imagecrop = [ 'resource-id' => $resource_id, diff --git a/src/Module/Xrd.php b/src/Module/Xrd.php index 3e55f0571b..39b4e2538c 100644 --- a/src/Module/Xrd.php +++ b/src/Module/Xrd.php @@ -64,6 +64,8 @@ class Xrd extends BaseModule header('Vary: Accept', false); + $alias = ''; + if ($name == User::getActorName()) { $owner = User::getSystemAccount(); if (empty($owner)) { @@ -108,7 +110,7 @@ class Xrd extends BaseModule $parts[] = current(explode(';', $part)); } - if (empty($parts)) { + if ($parts === []) { return $default; } elseif (in_array('application/jrd+json', $parts) && !in_array('application/xrd+xml', $parts)) { return Response::TYPE_JSON; diff --git a/src/Navigation/Notifications/ValueObject/FormattedNotify.php b/src/Navigation/Notifications/ValueObject/FormattedNotify.php index e8abfe283a..d92d39e426 100644 --- a/src/Navigation/Notifications/ValueObject/FormattedNotify.php +++ b/src/Navigation/Notifications/ValueObject/FormattedNotify.php @@ -41,13 +41,13 @@ class FormattedNotify extends BaseDataTransferObject public function __construct(string $label, string $link, string $image, string $url, string $text, string $when, string $ago, bool $seen) { - $this->label = $label ?? ''; - $this->link = $link ?? ''; - $this->image = $image ?? ''; - $this->url = $url ?? ''; - $this->text = $text ?? ''; - $this->when = $when ?? ''; - $this->ago = $ago ?? ''; - $this->seen = $seen ?? false; + $this->label = $label; + $this->link = $link; + $this->image = $image; + $this->url = $url; + $this->text = $text; + $this->when = $when; + $this->ago = $ago; + $this->seen = $seen; } } diff --git a/view/theme/frio/config.php b/view/theme/frio/config.php index b16289a032..d157b58a2d 100644 --- a/view/theme/frio/config.php +++ b/view/theme/frio/config.php @@ -92,7 +92,7 @@ function theme_admin_post() } } -function theme_content(): string +function theme_content(App $a): string { if (!DI::userSession()->getLocalUserId()) { return '';