diff --git a/administrator/modules/mod_feed/src/Helper/FeedHelper.php b/administrator/modules/mod_feed/src/Helper/FeedHelper.php index 7a50805cd27f1..6aeb39f618417 100644 --- a/administrator/modules/mod_feed/src/Helper/FeedHelper.php +++ b/administrator/modules/mod_feed/src/Helper/FeedHelper.php @@ -43,7 +43,7 @@ public function getFeedData(Registry $params, FeedFactory $feed): \Joomla\CMS\Fe // Get RSS parsed object try { $rssDoc = $feed->getFeed($rssurl); - } catch (\Exception $e) { + } catch (\Exception) { return Text::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED'); } diff --git a/administrator/modules/mod_privacy_dashboard/src/Helper/PrivacyDashboardHelper.php b/administrator/modules/mod_privacy_dashboard/src/Helper/PrivacyDashboardHelper.php index 7e61ff13bbc9d..e222594ae625e 100644 --- a/administrator/modules/mod_privacy_dashboard/src/Helper/PrivacyDashboardHelper.php +++ b/administrator/modules/mod_privacy_dashboard/src/Helper/PrivacyDashboardHelper.php @@ -50,7 +50,7 @@ public static function getData() try { return $db->loadObjectList(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return []; } } diff --git a/administrator/modules/mod_stats_admin/src/Helper/StatsAdminHelper.php b/administrator/modules/mod_stats_admin/src/Helper/StatsAdminHelper.php index 778e4cba0ad81..34c61629dcb47 100644 --- a/administrator/modules/mod_stats_admin/src/Helper/StatsAdminHelper.php +++ b/administrator/modules/mod_stats_admin/src/Helper/StatsAdminHelper.php @@ -96,7 +96,7 @@ public function getStatsData(Registry $params, CMSApplication $app, DatabaseInte try { $items = $db->loadResult(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $items = false; } diff --git a/modules/mod_articles_archive/src/Helper/ArticlesArchiveHelper.php b/modules/mod_articles_archive/src/Helper/ArticlesArchiveHelper.php index 690b62407cc46..a8fd6be30f6b4 100644 --- a/modules/mod_articles_archive/src/Helper/ArticlesArchiveHelper.php +++ b/modules/mod_articles_archive/src/Helper/ArticlesArchiveHelper.php @@ -67,7 +67,7 @@ public function getArticlesByMonths(Registry $moduleParams, SiteApplication $app try { $rows = (array) $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); return []; diff --git a/modules/mod_feed/src/Helper/FeedHelper.php b/modules/mod_feed/src/Helper/FeedHelper.php index d450085993714..a716ab862962a 100644 --- a/modules/mod_feed/src/Helper/FeedHelper.php +++ b/modules/mod_feed/src/Helper/FeedHelper.php @@ -42,7 +42,7 @@ public function getFeedInformation($params) try { $feed = new FeedFactory(); $rssDoc = $feed->getFeed($rssurl); - } catch (\Exception $e) { + } catch (\Exception) { return Text::_('MOD_FEED_ERR_FEED_NOT_RETRIEVED'); } diff --git a/modules/mod_related_items/src/Helper/RelatedItemsHelper.php b/modules/mod_related_items/src/Helper/RelatedItemsHelper.php index 1bbb6cac033ae..1cb33963268c9 100644 --- a/modules/mod_related_items/src/Helper/RelatedItemsHelper.php +++ b/modules/mod_related_items/src/Helper/RelatedItemsHelper.php @@ -86,7 +86,7 @@ public function getRelatedArticles(Registry $params, SiteApplication $app): arra try { $metakey = trim($db->loadResult()); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); return []; @@ -150,7 +150,7 @@ public function getRelatedArticles(Registry $params, SiteApplication $app): arra try { $articleIds = $db->loadColumn(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); return []; diff --git a/modules/mod_stats/src/Helper/StatsHelper.php b/modules/mod_stats/src/Helper/StatsHelper.php index 47d5d2479daf4..1c17dd96c0cf4 100644 --- a/modules/mod_stats/src/Helper/StatsHelper.php +++ b/modules/mod_stats/src/Helper/StatsHelper.php @@ -106,7 +106,7 @@ public function getStats(Registry &$params, CMSApplicationInterface $app) try { $items = $db->loadResult(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $items = false; } @@ -134,7 +134,7 @@ public function getStats(Registry &$params, CMSApplicationInterface $app) try { $hits = $db->loadResult(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $hits = false; } diff --git a/modules/mod_tags_similar/src/Helper/TagsSimilarHelper.php b/modules/mod_tags_similar/src/Helper/TagsSimilarHelper.php index 954b0ed3dd6e2..e5bde10ae20c6 100644 --- a/modules/mod_tags_similar/src/Helper/TagsSimilarHelper.php +++ b/modules/mod_tags_similar/src/Helper/TagsSimilarHelper.php @@ -204,7 +204,7 @@ public function getItems(&$params) try { $results = $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $results = []; $app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); } diff --git a/modules/mod_users_latest/src/Helper/UsersLatestHelper.php b/modules/mod_users_latest/src/Helper/UsersLatestHelper.php index 84eb29738056a..c32614d7a9598 100644 --- a/modules/mod_users_latest/src/Helper/UsersLatestHelper.php +++ b/modules/mod_users_latest/src/Helper/UsersLatestHelper.php @@ -69,7 +69,7 @@ public function getLatestUsers(Registry $params, SiteApplication $app): array try { return (array) $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $app->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); return []; diff --git a/modules/mod_whosonline/src/Helper/WhosonlineHelper.php b/modules/mod_whosonline/src/Helper/WhosonlineHelper.php index caa1e642cb322..84ad110af5f23 100644 --- a/modules/mod_whosonline/src/Helper/WhosonlineHelper.php +++ b/modules/mod_whosonline/src/Helper/WhosonlineHelper.php @@ -49,7 +49,7 @@ public static function getOnlineCount() try { $sessions = (array) $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $sessions = []; } @@ -113,7 +113,7 @@ public static function getOnlineUserNames($params) try { return (array) $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return []; } } diff --git a/plugins/actionlog/joomla/src/Extension/Joomla.php b/plugins/actionlog/joomla/src/Extension/Joomla.php index 64d56acf74223..8fcd689de4176 100644 --- a/plugins/actionlog/joomla/src/Extension/Joomla.php +++ b/plugins/actionlog/joomla/src/Extension/Joomla.php @@ -316,7 +316,7 @@ public function onContentChangeState(Model\AfterChangeStateEvent $event): void try { $items = $db->loadObjectList($params->id_holder); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $items = []; } @@ -875,7 +875,7 @@ public function onUserLoginFailure(User\LoginFailureEvent $event): void try { $loggedInUser = $db->loadObject(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return; } diff --git a/plugins/api-authentication/token/src/Extension/Token.php b/plugins/api-authentication/token/src/Extension/Token.php index b6e21814ba70b..b9a98aa03ad82 100644 --- a/plugins/api-authentication/token/src/Extension/Token.php +++ b/plugins/api-authentication/token/src/Extension/Token.php @@ -180,7 +180,7 @@ public function onUserAuthenticate(AuthenticationEvent $event): void */ try { $siteSecret = $this->getApplication()->get('secret'); - } catch (\Exception $e) { + } catch (\Exception) { return; } @@ -282,7 +282,7 @@ private function getTokenSeedForUser(int $userId): ?string $query->bind(':userId', $userId, ParameterType::INTEGER); return $db->setQuery($query)->loadResult(); - } catch (\Exception $e) { + } catch (\Exception) { return null; } } @@ -313,7 +313,7 @@ private function isTokenEnabledForUser(int $userId): bool $value = $db->setQuery($query)->loadResult(); return $value == 1; - } catch (\Exception $e) { + } catch (\Exception) { return false; } } diff --git a/plugins/authentication/cookie/src/Extension/Cookie.php b/plugins/authentication/cookie/src/Extension/Cookie.php index 20b33d8623160..7a1b157ac7654 100644 --- a/plugins/authentication/cookie/src/Extension/Cookie.php +++ b/plugins/authentication/cookie/src/Extension/Cookie.php @@ -208,7 +208,7 @@ public function onUserAuthenticate(AuthenticationEvent $event): void try { $result = $db->setQuery($query)->loadObject(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $response->status = Authentication::STATUS_FAILURE; return; @@ -303,7 +303,7 @@ public function onUserAfterLogin(AfterLoginEvent $event): void if ($results === null) { $unique = true; } - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $errorCount++; // We'll let this query fail up to 5 times before giving up, there's probably a bigger issue at this point @@ -370,7 +370,7 @@ public function onUserAfterLogin(AfterLoginEvent $event): void try { $db->setQuery($query)->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { // We aren't concerned with errors from this query, carry on } } @@ -416,7 +416,7 @@ public function onUserAfterLogout(AfterLogoutEvent $event): void try { $db->setQuery($query)->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { // We aren't concerned with errors from this query, carry on } diff --git a/plugins/content/confirmconsent/src/Field/ConsentBoxField.php b/plugins/content/confirmconsent/src/Field/ConsentBoxField.php index 8357cac139e50..01e322e7667a6 100644 --- a/plugins/content/confirmconsent/src/Field/ConsentBoxField.php +++ b/plugins/content/confirmconsent/src/Field/ConsentBoxField.php @@ -250,7 +250,7 @@ private function getAssignedArticleUrl() try { $article = $db->loadObject(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { // Something at the database layer went wrong return Route::_( 'index.php?option=com_content&view=article&id=' diff --git a/plugins/editors/tinymce/src/PluginTraits/ActiveSiteTemplate.php b/plugins/editors/tinymce/src/PluginTraits/ActiveSiteTemplate.php index 2b0d6b0b28a2d..64f19c61a275c 100644 --- a/plugins/editors/tinymce/src/PluginTraits/ActiveSiteTemplate.php +++ b/plugins/editors/tinymce/src/PluginTraits/ActiveSiteTemplate.php @@ -47,7 +47,7 @@ protected function getActiveSiteTemplate() try { return $db->loadObject(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $this->getApplication()->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); return new \stdClass(); diff --git a/plugins/extension/finder/src/Extension/Finder.php b/plugins/extension/finder/src/Extension/Finder.php index 05acb5071e935..2b5332f6ffd86 100644 --- a/plugins/extension/finder/src/Extension/Finder.php +++ b/plugins/extension/finder/src/Extension/Finder.php @@ -177,7 +177,7 @@ function ($word) { try { $db->setQuery($query); $db->execute(); - } catch (\Exception $ex) { + } catch (\Exception) { // It would be nice if the common word is stored to the DB, but it isn't super important } } diff --git a/plugins/filesystem/local/src/Adapter/LocalAdapter.php b/plugins/filesystem/local/src/Adapter/LocalAdapter.php index 1e2f58d7b4dbf..2bc9619a60933 100644 --- a/plugins/filesystem/local/src/Adapter/LocalAdapter.php +++ b/plugins/filesystem/local/src/Adapter/LocalAdapter.php @@ -262,7 +262,7 @@ public function createFile(string $name, string $path, $data): string try { File::write($localPath, $data); - } catch (FilesystemException $exception) { + } catch (FilesystemException) { } if ($this->thumbnails && MediaHelper::isImage(pathinfo($localPath)['basename'])) { @@ -303,7 +303,7 @@ public function updateFile(string $name, string $path, $data) try { File::write($localPath, $data); - } catch (FilesystemException $exception) { + } catch (FilesystemException) { } if ($this->thumbnails && MediaHelper::isImage(pathinfo($localPath)['basename'])) { @@ -426,7 +426,7 @@ private function getPathInformation(string $path): \stdClass $obj->height = $props->height; $obj->thumb_path = $this->thumbnails ? $this->getThumbnail($path) : $this->getUrl($obj->path); - } catch (UnparsableImageException $e) { + } catch (UnparsableImageException) { // Ignore the exception - it's an image that we don't know how to parse right now } } @@ -537,7 +537,7 @@ private function copyFile(string $sourcePath, string $destinationPath, bool $for try { File::copy($sourcePath, $destinationPath); - } catch (FilesystemException $exception) { + } catch (FilesystemException) { throw new \Exception(Text::_('COM_MEDIA_COPY_FILE_NOT_POSSIBLE')); } } @@ -564,7 +564,7 @@ private function copyFolder(string $sourcePath, string $destinationPath, bool $f if (is_file($destinationPath)) { File::delete($destinationPath); } - } catch (FilesystemException $exception) { + } catch (FilesystemException) { throw new \Exception(Text::_('COM_MEDIA_COPY_FOLDER_DESTINATION_CAN_NOT_DELETE')); } @@ -652,7 +652,7 @@ private function moveFile(string $sourcePath, string $destinationPath, bool $for try { File::move($sourcePath, $destinationPath); - } catch (FilesystemException $exception) { + } catch (FilesystemException) { throw new \Exception(Text::_('COM_MEDIA_MOVE_FILE_NOT_POSSIBLE')); } } @@ -679,7 +679,7 @@ private function moveFolder(string $sourcePath, string $destinationPath, bool $f if (is_file($destinationPath)) { File::delete($destinationPath); } - } catch (FilesystemException $exception) { + } catch (FilesystemException) { throw new \Exception(Text::_('COM_MEDIA_MOVE_FOLDER_NOT_POSSIBLE')); } @@ -860,7 +860,7 @@ private function checkContent(string $localPath, string $mediaContent) try { File::delete($tmpFile); - } catch (FilesystemException $exception) { + } catch (FilesystemException) { } if (!$can) { @@ -986,7 +986,7 @@ private function createThumbnail(string $path, string $thumbnailPath): bool { try { (new Image($path))->createThumbnails([$this->thumbnailSize[0] . 'x' . $this->thumbnailSize[1]], Image::SCALE_INSIDE, \dirname($thumbnailPath), true); - } catch (\Exception $e) { + } catch (\Exception) { return false; } diff --git a/plugins/installer/override/src/Extension/Override.php b/plugins/installer/override/src/Extension/Override.php index 6cf60631e1d96..a1ea7e6782d32 100644 --- a/plugins/installer/override/src/Extension/Override.php +++ b/plugins/installer/override/src/Extension/Override.php @@ -175,7 +175,7 @@ public function getOverrideCoreList() try { /** @var \Joomla\Component\Templates\Administrator\Model\TemplateModel $templateModel */ $templateModel = $this->getModel(); - } catch (\Exception $e) { + } catch (\Exception) { return []; } diff --git a/plugins/multifactorauth/email/src/Extension/Email.php b/plugins/multifactorauth/email/src/Extension/Email.php index 0924b6c83740f..2bd4d1edc0aa4 100644 --- a/plugins/multifactorauth/email/src/Extension/Email.php +++ b/plugins/multifactorauth/email/src/Extension/Email.php @@ -173,7 +173,7 @@ public function onUserMultifactorCaptive(Captive $event): void try { $this->sendCode($key, $user); - } catch (\Exception $e) { + } catch (\Exception) { return; } @@ -476,7 +476,7 @@ function (MfaTable $record) { 'user_id' => $user->id, ] ); - } catch (\Exception $event) { + } catch (\Exception) { // Fail gracefully } } diff --git a/plugins/multifactorauth/webauthn/src/Extension/Webauthn.php b/plugins/multifactorauth/webauthn/src/Extension/Webauthn.php index d1df17ead70f9..e1604ae8dcbcd 100644 --- a/plugins/multifactorauth/webauthn/src/Extension/Webauthn.php +++ b/plugins/multifactorauth/webauthn/src/Extension/Webauthn.php @@ -344,7 +344,7 @@ public function onUserMultifactorCaptive(Captive $event): void ob_start(); include $layoutPath; $html = ob_get_clean(); - } catch (\Exception $e) { + } catch (\Exception) { return; } @@ -422,7 +422,7 @@ public function onUserMultifactorValidate(Validate $event): void } catch (\Exception $e) { try { $this->getApplication()->enqueueMessage($e->getMessage(), 'error'); - } catch (\Exception $e) { + } catch (\Exception) { } $event->addResult(false); diff --git a/plugins/multifactorauth/webauthn/src/Helper/Credentials.php b/plugins/multifactorauth/webauthn/src/Helper/Credentials.php index c9a8026199859..94444a801cd99 100644 --- a/plugins/multifactorauth/webauthn/src/Helper/Credentials.php +++ b/plugins/multifactorauth/webauthn/src/Helper/Credentials.php @@ -105,7 +105,7 @@ public static function verifyAttestation(string $data): ?PublicKeyCredentialSour try { $publicKeyCredentialCreationOptions = unserialize(base64_decode($encodedOptions)); - } catch (\Exception $e) { + } catch (\Exception) { $publicKeyCredentialCreationOptions = null; } @@ -274,7 +274,7 @@ private static function getWebauthnServer(?int $userId): Server try { $app = Factory::getApplication(); $siteName = $app->get('sitename'); - } catch (\Exception $e) { + } catch (\Exception) { $siteName = 'Joomla! Site'; } diff --git a/plugins/multifactorauth/yubikey/src/Extension/Yubikey.php b/plugins/multifactorauth/yubikey/src/Extension/Yubikey.php index 61f26ff9f1d54..ed10669dedf0c 100644 --- a/plugins/multifactorauth/yubikey/src/Extension/Yubikey.php +++ b/plugins/multifactorauth/yubikey/src/Extension/Yubikey.php @@ -319,7 +319,7 @@ function ($rec) use ($record) { return $rec->method === $record->method; } ); - } catch (\Exception $e) { + } catch (\Exception) { $records = []; } @@ -409,7 +409,7 @@ private function validateYubikeyOtp(string $otp): bool } else { continue; } - } catch (\Exception $exc) { + } catch (\Exception) { // No response, continue with the next server continue; } diff --git a/plugins/sampledata/multilang/src/Extension/MultiLanguage.php b/plugins/sampledata/multilang/src/Extension/MultiLanguage.php index 377c4a02f91a4..1974b8ed34e58 100644 --- a/plugins/sampledata/multilang/src/Extension/MultiLanguage.php +++ b/plugins/sampledata/multilang/src/Extension/MultiLanguage.php @@ -527,7 +527,7 @@ private function enablePlugin($pluginName) try { $db->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return false; } @@ -553,7 +553,7 @@ private function enablePlugin($pluginName) try { $db->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return false; } } @@ -590,7 +590,7 @@ private function disableModuleMainMenu() try { $db->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return false; } @@ -922,7 +922,7 @@ private function addAssociations($groupedAssociations) try { $db->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return false; } } @@ -956,7 +956,7 @@ private function addModuleInModuleMenu($moduleId) try { $db->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return false; } @@ -1132,7 +1132,7 @@ private function addArticle($itemLanguage, $categoryId) if ($stage_id) { $workflow->createAssociation($newId, $stage_id); } - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return false; } diff --git a/plugins/schemaorg/custom/src/Extension/Custom.php b/plugins/schemaorg/custom/src/Extension/Custom.php index 0024c560cbb73..b08065724c1b2 100644 --- a/plugins/schemaorg/custom/src/Extension/Custom.php +++ b/plugins/schemaorg/custom/src/Extension/Custom.php @@ -76,7 +76,7 @@ public function onSchemaPrepareSave(PrepareSaveEvent $event): void $schema = new Registry($subject->schema); $json = (new Registry($schema->get('json')))->toArray(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $this->getApplication()->enqueueMessage(Text::_('PLG_SCHEMAORG_CUSTOM_JSON_ERROR'), 'error'); return; } diff --git a/plugins/system/actionlogs/src/Extension/ActionLogs.php b/plugins/system/actionlogs/src/Extension/ActionLogs.php index 7c4de3bfb9870..0ed4effdde34d 100644 --- a/plugins/system/actionlogs/src/Extension/ActionLogs.php +++ b/plugins/system/actionlogs/src/Extension/ActionLogs.php @@ -182,7 +182,7 @@ public function onContentPrepareData(Model\PrepareDataEvent $event): void try { $values = $db->setQuery($query)->loadObject(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return; } @@ -292,7 +292,7 @@ public function onUserAfterSave(User\AfterSaveEvent $event): void try { $db->setQuery($query)->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { // Do nothing. } } @@ -325,7 +325,7 @@ public function onUserAfterDelete(User\AfterDeleteEvent $event): void try { $db->setQuery($query)->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { // Do nothing. } } @@ -399,7 +399,7 @@ public function onExtensionAfterSave(Model\AfterSaveEvent $event): void try { $values = $db->setQuery($query)->loadObjectList(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return; } @@ -420,7 +420,7 @@ public function onExtensionAfterSave(Model\AfterSaveEvent $event): void try { $db->setQuery($query)->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { // Do nothing. } } diff --git a/plugins/system/guidedtours/src/Extension/GuidedTours.php b/plugins/system/guidedtours/src/Extension/GuidedTours.php index 15c9e81e9f18f..6598411423d2f 100644 --- a/plugins/system/guidedtours/src/Extension/GuidedTours.php +++ b/plugins/system/guidedtours/src/Extension/GuidedTours.php @@ -214,7 +214,7 @@ public function onBeforeCompileHead() try { $result = $db->setQuery($query)->loadResult(); - } catch (\Exception $e) { + } catch (\Exception) { // Do not start the tour. continue; } diff --git a/plugins/system/log/src/Extension/Log.php b/plugins/system/log/src/Extension/Log.php index 96601d0569042..bf52c7c1abd76 100644 --- a/plugins/system/log/src/Extension/Log.php +++ b/plugins/system/log/src/Extension/Log.php @@ -81,7 +81,7 @@ public function onUserLoginFailure(LoginFailureEvent $event): void try { Logger::add($errorlog['comment'], Logger::INFO, $errorlog['status']); - } catch (\Exception $e) { + } catch (\Exception) { // If the log file is unwriteable during login then we should not go to the error page return; } diff --git a/plugins/system/privacyconsent/src/Extension/PrivacyConsent.php b/plugins/system/privacyconsent/src/Extension/PrivacyConsent.php index 17abfcce198c8..be7a3a344562a 100644 --- a/plugins/system/privacyconsent/src/Extension/PrivacyConsent.php +++ b/plugins/system/privacyconsent/src/Extension/PrivacyConsent.php @@ -200,7 +200,7 @@ public function onUserAfterSave(User\AfterSaveEvent $event): void try { $this->getDatabase()->insertObject('#__privacy_consents', $userNote); - } catch (\Exception $e) { + } catch (\Exception) { // Do nothing if the save fails } diff --git a/plugins/system/redirect/src/Extension/Redirect.php b/plugins/system/redirect/src/Extension/Redirect.php index b74325bc5b77e..8bdb1b71c102d 100644 --- a/plugins/system/redirect/src/Extension/Redirect.php +++ b/plugins/system/redirect/src/Extension/Redirect.php @@ -214,7 +214,7 @@ public function handleError(ErrorEvent $event) try { $this->getDatabase()->updateObject('#__redirect_links', $redirect, 'id'); - } catch (\Exception $e) { + } catch (\Exception) { // We don't log issues for now } diff --git a/plugins/system/schedulerunner/src/Extension/ScheduleRunner.php b/plugins/system/schedulerunner/src/Extension/ScheduleRunner.php index a4ea9742b2dd3..b285b7e844795 100644 --- a/plugins/system/schedulerunner/src/Extension/ScheduleRunner.php +++ b/plugins/system/schedulerunner/src/Extension/ScheduleRunner.php @@ -163,7 +163,7 @@ public function runLazyCron(EventInterface $e) // Suppress all errors to avoid any output try { $this->runScheduler(); - } catch (\Exception $e) { + } catch (\Exception) { } ob_end_clean(); diff --git a/plugins/system/stats/src/Extension/Stats.php b/plugins/system/stats/src/Extension/Stats.php index 5e385cfd641db..208e451788440 100644 --- a/plugins/system/stats/src/Extension/Stats.php +++ b/plugins/system/stats/src/Extension/Stats.php @@ -498,7 +498,7 @@ private function saveParams() $result = $db->setQuery($query)->execute(); $this->clearCacheGroups(['com_plugins']); - } catch (\Exception $exc) { + } catch (\Exception) { // If we failed to execute $db->unlockTables(); $result = false; @@ -507,7 +507,7 @@ private function saveParams() try { // Unlock the tables after writing $db->unlockTables(); - } catch (\Exception $e) { + } catch (\Exception) { // If we can't lock the tables assume we have somehow failed $result = false; } @@ -585,7 +585,7 @@ private function clearCacheGroups(array $clearGroups) $cache = Cache::getInstance('callback', $options); $cache->clean(); - } catch (\Exception $e) { + } catch (\Exception) { // Ignore it } } @@ -623,7 +623,7 @@ private function disablePlugin() $result = $db->setQuery($query)->execute(); $this->clearCacheGroups(['com_plugins']); - } catch (\Exception $exc) { + } catch (\Exception) { // If we failed to execute $db->unlockTables(); $result = false; @@ -632,7 +632,7 @@ private function disablePlugin() try { // Unlock the tables after writing $db->unlockTables(); - } catch (\Exception $e) { + } catch (\Exception) { // If we can't lock the tables assume we have somehow failed $result = false; } diff --git a/plugins/system/tasknotification/src/Extension/TaskNotification.php b/plugins/system/tasknotification/src/Extension/TaskNotification.php index 31d3cb32b8e25..9097b6ab6a5a6 100644 --- a/plugins/system/tasknotification/src/Extension/TaskNotification.php +++ b/plugins/system/tasknotification/src/Extension/TaskNotification.php @@ -97,7 +97,7 @@ public function injectTaskNotificationFieldset(Model\PrepareFormEvent $event): b try { $formFile = Path::check($formFile); - } catch (\Exception $e) { + } catch (\Exception) { // Log? return false; } @@ -290,7 +290,7 @@ private function sendMail(string $template, array $data, string $attachment = '' try { $users = $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return; } @@ -323,7 +323,7 @@ private function sendMail(string $template, array $data, string $attachment = '' $mailer->send(); $mailSent = true; - } catch (MailerException $exception) { + } catch (MailerException) { Log::add($this->getApplication()->getLanguage()->_('PLG_SYSTEM_TASK_NOTIFICATION_NOTIFY_SEND_EMAIL_FAIL'), Log::ERROR); } } diff --git a/plugins/system/webauthn/src/Authentication.php b/plugins/system/webauthn/src/Authentication.php index c8b12f620ad5a..3c7ab9e2c6208 100644 --- a/plugins/system/webauthn/src/Authentication.php +++ b/plugins/system/webauthn/src/Authentication.php @@ -308,7 +308,7 @@ public function validateAttestationResponse(string $data): PublicKeyCredentialSo /** @var PublicKeyCredentialCreationOptions|null $publicKeyCredentialCreationOptions */ try { $publicKeyCredentialCreationOptions = unserialize(base64_decode($encodedOptions)); - } catch (\Exception $e) { + } catch (\Exception) { Log::add('The plg_system_webauthn.publicKeyCredentialCreationOptions in the session is invalid', Log::NOTICE, 'webauthn.system'); $publicKeyCredentialCreationOptions = null; } @@ -392,7 +392,7 @@ private function getSiteIcon(): ?string '/templates/', '/templates/' . $this->app->getTemplate(), ]; - } catch (\Exception $e) { + } catch (\Exception) { return null; } @@ -502,7 +502,7 @@ private function getPKCredentialRequestOptions(): PublicKeyCredentialRequestOpti try { $publicKeyCredentialRequestOptions = unserialize(base64_decode($encodedOptions)); - } catch (\Exception $e) { + } catch (\Exception) { Log::add('Invalid plg_system_webauthn.publicKeyCredentialRequestOptions in the session', Log::NOTICE, 'webauthn.system'); throw new \RuntimeException(Text::_('PLG_SYSTEM_WEBAUTHN_ERR_CREATE_INVALID_LOGIN_REQUEST')); diff --git a/plugins/system/webauthn/src/CredentialRepository.php b/plugins/system/webauthn/src/CredentialRepository.php index fc3c22877e08f..cfb5a03fc466a 100644 --- a/plugins/system/webauthn/src/CredentialRepository.php +++ b/plugins/system/webauthn/src/CredentialRepository.php @@ -79,7 +79,7 @@ public function findOneByCredentialId(string $publicKeyCredentialId): ?PublicKey try { return PublicKeyCredentialSource::createFromArray(json_decode($json, true)); - } catch (\Throwable $e) { + } catch (\Throwable) { return null; } } @@ -136,7 +136,7 @@ public function findAllForUserEntity(PublicKeyCredentialUserEntity $publicKeyCre try { return PublicKeyCredentialSource::createFromArray($data); - } catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException) { return null; } }; @@ -222,7 +222,7 @@ public function saveCredentialSource(PublicKeyCredentialSource $publicKeyCredent $o->user_id = $oldRecord->user_id; $o->label = $oldRecord->label; $update = true; - } catch (\Exception $e) { + } catch (\Exception) { } $o->credential = $this->encryptCredential($o->credential); @@ -304,7 +304,7 @@ public function getAll(int $userId): array $record['credential'] = PublicKeyCredentialSource::createFromArray($data); return $record; - } catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException) { $record['credential'] = null; return $record; @@ -338,7 +338,7 @@ public function has(string $credentialId): bool $count = $db->setQuery($query)->loadResult(); return $count > 0; - } catch (\Exception $e) { + } catch (\Exception) { return false; } } @@ -473,7 +473,7 @@ public function getUserIdFromHandle(?string $userHandle): ?int try { $numRecords = $db->setQuery($query)->loadResult(); - } catch (\Exception $e) { + } catch (\Exception) { return null; } @@ -501,7 +501,7 @@ public function getUserIdFromHandle(?string $userHandle): ?int while (true) { try { $ids = $db->setQuery($query, $start, $limit)->loadColumn(); - } catch (\Exception $e) { + } catch (\Exception) { return null; } @@ -585,7 +585,7 @@ private function getEncryptionKey(): string /** @var Registry $config */ $config = $app->getConfig(); $secret = $config->get('secret', ''); - } catch (\Exception $e) { + } catch (\Exception) { $secret = ''; } @@ -621,7 +621,7 @@ private function formatDate($date, ?string $format = null, bool $tzAware = true) try { $tzDefault = Factory::getApplication()->get('offset'); - } catch (\Exception $e) { + } catch (\Exception) { $tzDefault = 'GMT'; } @@ -634,7 +634,7 @@ private function formatDate($date, ?string $format = null, bool $tzAware = true) $userTimeZone = new \DateTimeZone($tz); $jDate->setTimezone($userTimeZone); - } catch (\Exception $e) { + } catch (\Exception) { // Nothing. Fall back to UTC. } } diff --git a/plugins/system/webauthn/src/Extension/Webauthn.php b/plugins/system/webauthn/src/Extension/Webauthn.php index 876e04cd48971..4f468bdaae40d 100644 --- a/plugins/system/webauthn/src/Extension/Webauthn.php +++ b/plugins/system/webauthn/src/Extension/Webauthn.php @@ -155,7 +155,7 @@ public static function getSubscribedEvents(): array { try { $app = Factory::getApplication(); - } catch (\Exception $e) { + } catch (\Exception) { return []; } diff --git a/plugins/system/webauthn/src/MetadataRepository.php b/plugins/system/webauthn/src/MetadataRepository.php index 4d61056780c13..e157860ae4957 100644 --- a/plugins/system/webauthn/src/MetadataRepository.php +++ b/plugins/system/webauthn/src/MetadataRepository.php @@ -128,7 +128,7 @@ private function load(): void try { $jwtConfig = Configuration::forUnsecuredSigner(); $token = $jwtConfig->parser()->parse($rawJwt); - } catch (\Exception $e) { + } catch (\Exception) { return; } @@ -153,7 +153,7 @@ private function load(): void } return MetadataStatement::createFromArray($array); - } catch (\Exception $e) { + } catch (\Exception) { return null; } }; diff --git a/plugins/system/webauthn/src/PluginTraits/AdditionalLoginButtons.php b/plugins/system/webauthn/src/PluginTraits/AdditionalLoginButtons.php index cbf17cd67bfde..573b962185711 100644 --- a/plugins/system/webauthn/src/PluginTraits/AdditionalLoginButtons.php +++ b/plugins/system/webauthn/src/PluginTraits/AdditionalLoginButtons.php @@ -138,7 +138,7 @@ private function mustDisplayButton(): bool */ try { $document = $this->getApplication()->getDocument(); - } catch (\Exception $e) { + } catch (\Exception) { $document = null; } diff --git a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerChallenge.php b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerChallenge.php index 6de8ad4c124f3..d3c93729eca56 100644 --- a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerChallenge.php +++ b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerChallenge.php @@ -89,7 +89,7 @@ public function onAjaxWebauthnChallenge(AjaxChallenge $event): void try { $myUser = Factory::getContainer()->get(UserFactoryInterface::class)->loadUserById($userId); - } catch (\Exception $e) { + } catch (\Exception) { $myUser = new User(); } diff --git a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerDelete.php b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerDelete.php index 1a7d0febe33a4..d064d2dc5784d 100644 --- a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerDelete.php +++ b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerDelete.php @@ -81,7 +81,7 @@ public function onAjaxWebauthnDelete(AjaxDelete $event): void // Delete the record try { $repository->remove($credentialId); - } catch (\Exception $e) { + } catch (\Exception) { $event->addResult(false); return; diff --git a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerSaveLabel.php b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerSaveLabel.php index aa188019d20db..f1647f1057e03 100644 --- a/plugins/system/webauthn/src/PluginTraits/AjaxHandlerSaveLabel.php +++ b/plugins/system/webauthn/src/PluginTraits/AjaxHandlerSaveLabel.php @@ -90,7 +90,7 @@ public function onAjaxWebauthnSavelabel(AjaxSaveLabel $event): void // Save the new label try { $repository->setLabel($credentialId, $newLabel); - } catch (\Exception $e) { + } catch (\Exception) { $event->addResult(false); return; diff --git a/plugins/system/webauthn/src/PluginTraits/UserDeletion.php b/plugins/system/webauthn/src/PluginTraits/UserDeletion.php index 5dd83d6016c69..9a883f5157a80 100644 --- a/plugins/system/webauthn/src/PluginTraits/UserDeletion.php +++ b/plugins/system/webauthn/src/PluginTraits/UserDeletion.php @@ -66,7 +66,7 @@ public function onUserAfterDelete(Event $event): void try { $db->setQuery($query)->execute(); - } catch (\Exception $e) { + } catch (\Exception) { // Don't worry if this fails } diff --git a/plugins/task/checkfiles/src/Extension/Checkfiles.php b/plugins/task/checkfiles/src/Extension/Checkfiles.php index 7c1ab16a9cbe0..a85f4c73b183c 100644 --- a/plugins/task/checkfiles/src/Extension/Checkfiles.php +++ b/plugins/task/checkfiles/src/Extension/Checkfiles.php @@ -143,7 +143,7 @@ protected function checkImages(ExecuteTaskEvent $event): int try { $image->resize($newWidth, $newHeight, false); - } catch (\LogicException $e) { + } catch (\LogicException) { $this->logTask($this->getApplication()->getLanguage()->_('PLG_TASK_CHECK_FILES_LOG_RESIZE_FAIL'), 'error'); return TaskStatus::KNOCKOUT; diff --git a/plugins/task/deleteactionlogs/src/Extension/DeleteActionLogs.php b/plugins/task/deleteactionlogs/src/Extension/DeleteActionLogs.php index 1b756739ca27c..0015106b2dfe6 100644 --- a/plugins/task/deleteactionlogs/src/Extension/DeleteActionLogs.php +++ b/plugins/task/deleteactionlogs/src/Extension/DeleteActionLogs.php @@ -94,7 +94,7 @@ private function deleteLogs(ExecuteTaskEvent $event): int try { $db->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { // Ignore it return Status::KNOCKOUT; } diff --git a/plugins/task/globalcheckin/src/Extension/Globalcheckin.php b/plugins/task/globalcheckin/src/Extension/Globalcheckin.php index 8f63a9aa035be..e4fdaca17dce2 100644 --- a/plugins/task/globalcheckin/src/Extension/Globalcheckin.php +++ b/plugins/task/globalcheckin/src/Extension/Globalcheckin.php @@ -114,7 +114,7 @@ protected function makeCheckin(ExecuteTaskEvent $event): int try { $db->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { // This failure isn't critical, don't care too much $failed = true; } diff --git a/plugins/task/privacyconsent/src/Extension/PrivacyConsent.php b/plugins/task/privacyconsent/src/Extension/PrivacyConsent.php index 2114be4957825..4ff194dd5d8e5 100644 --- a/plugins/task/privacyconsent/src/Extension/PrivacyConsent.php +++ b/plugins/task/privacyconsent/src/Extension/PrivacyConsent.php @@ -133,7 +133,7 @@ private function remindExpiringConsents($expire, $remind): int try { $users = $db->setQuery($query)->loadObjectList(); - } catch (\RuntimeException $exception) { + } catch (\RuntimeException) { return Status::KNOCKOUT; } @@ -183,10 +183,10 @@ private function remindExpiringConsents($expire, $remind): int try { $db->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return Status::KNOCKOUT; } - } catch (MailDisabledException | phpmailerException $exception) { + } catch (MailDisabledException | phpmailerException) { return Status::KNOCKOUT; } } @@ -222,7 +222,7 @@ private function invalidateExpiredConsents($expire): int try { $users = $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return Status::KNOCKOUT; } @@ -246,7 +246,7 @@ private function invalidateExpiredConsents($expire): int try { $db->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return Status::KNOCKOUT; } diff --git a/plugins/task/requests/src/Extension/Requests.php b/plugins/task/requests/src/Extension/Requests.php index 606d1d9a00b9a..eb595d0ac3b18 100644 --- a/plugins/task/requests/src/Extension/Requests.php +++ b/plugins/task/requests/src/Extension/Requests.php @@ -146,7 +146,7 @@ protected function makeGetRequest(ExecuteTaskEvent $event): int File::write($responseFilename, $responseBody); $this->snapshot['output_file'] = $responseFilename; $responseStatus = 'SAVED'; - } catch (\Exception $e) { + } catch (\Exception) { $this->logTask($this->getApplication()->getLanguage()->_('PLG_TASK_REQUESTS_TASK_GET_REQUEST_LOG_UNWRITEABLE_OUTPUT'), 'error'); $responseStatus = 'NOT_SAVED'; } diff --git a/plugins/task/rotatelogs/src/Extension/RotateLogs.php b/plugins/task/rotatelogs/src/Extension/RotateLogs.php index 542de9e9746a9..65237a2abd97b 100644 --- a/plugins/task/rotatelogs/src/Extension/RotateLogs.php +++ b/plugins/task/rotatelogs/src/Extension/RotateLogs.php @@ -103,7 +103,7 @@ private function rotateLogs(ExecuteTaskEvent $event): int foreach ($files as $file) { try { File::delete($logPath . '/' . $file); - } catch (FilesystemException $exception) { + } catch (FilesystemException) { } } } else { @@ -146,7 +146,7 @@ private function rotate($path, $filename, $currentVersion) try { File::move($path . '/' . $filename, $rotatedFile); - } catch (FilesystemException $exception) { + } catch (FilesystemException) { } } diff --git a/plugins/task/sitestatus/src/Extension/SiteStatus.php b/plugins/task/sitestatus/src/Extension/SiteStatus.php index da446799f2282..6bf6064da0806 100644 --- a/plugins/task/sitestatus/src/Extension/SiteStatus.php +++ b/plugins/task/sitestatus/src/Extension/SiteStatus.php @@ -171,7 +171,7 @@ private function writeConfigFile(Registry $config): int // Attempt to write the configuration file as a PHP class named JConfig. $configuration = $config->toString('PHP', ['class' => 'JConfig', 'closingtag' => false]); File::write($file, $configuration); - } catch (\Exception $e) { + } catch (\Exception) { $this->logTask($this->getApplication()->getLanguage()->_('PLG_TASK_SITE_STATUS_ERROR_WRITE_FAILED'), 'error'); return Status::KNOCKOUT; diff --git a/plugins/task/updatenotification/src/Extension/UpdateNotification.php b/plugins/task/updatenotification/src/Extension/UpdateNotification.php index 7ad5464b0c54e..c685edb9413ac 100644 --- a/plugins/task/updatenotification/src/Extension/UpdateNotification.php +++ b/plugins/task/updatenotification/src/Extension/UpdateNotification.php @@ -203,7 +203,7 @@ private function sendNotification(ExecuteTaskEvent $event): int } catch (MailDisabledException | phpMailerException $exception) { try { $this->logTask($jLanguage->_($exception->getMessage())); - } catch (\RuntimeException $exception) { + } catch (\RuntimeException) { return Status::KNOCKOUT; } } @@ -300,7 +300,7 @@ private function getSuperUsers($email = null) $db->setQuery($query); $ret = $db->loadObjectList(); - } catch (\Exception $exc) { + } catch (\Exception) { return $ret; } diff --git a/plugins/user/joomla/src/Extension/Joomla.php b/plugins/user/joomla/src/Extension/Joomla.php index 2e57b02b22b2a..09148bab8d66c 100644 --- a/plugins/user/joomla/src/Extension/Joomla.php +++ b/plugins/user/joomla/src/Extension/Joomla.php @@ -164,7 +164,7 @@ public function onUserAfterDelete(AfterDeleteEvent $event): void try { $db->setQuery($query)->execute(); - } catch (\Exception $e) { + } catch (\Exception) { // Do nothing } } @@ -349,7 +349,7 @@ public function onUserLogin(LoginEvent $event) try { $db->setQuery($query)->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { // The old session is already invalidated, don't let this block logging in } diff --git a/plugins/user/profile/src/Extension/Profile.php b/plugins/user/profile/src/Extension/Profile.php index 37961248c2310..0f42e8c13a186 100644 --- a/plugins/user/profile/src/Extension/Profile.php +++ b/plugins/user/profile/src/Extension/Profile.php @@ -328,7 +328,7 @@ public function onUserBeforeSave(BeforeSaveEvent $event) try { $date = new Date($data['profile']['dob']); $this->date = $date->format('Y-m-d H:i:s'); - } catch (\Exception $e) { + } catch (\Exception) { // Throw an exception if date is not valid. throw new \InvalidArgumentException($this->getApplication()->getLanguage()->_('PLG_USER_PROFILE_ERROR_INVALID_DOB')); } diff --git a/plugins/user/token/src/Extension/Token.php b/plugins/user/token/src/Extension/Token.php index a523718476323..96591be720708 100644 --- a/plugins/user/token/src/Extension/Token.php +++ b/plugins/user/token/src/Extension/Token.php @@ -158,7 +158,7 @@ public function onContentPrepareData(PrepareDataEvent $event): void $data->{$this->profileKeyPrefix}[$k] = $v[1]; } - } catch (\Exception $e) { + } catch (\Exception) { // We suppress any database error. It means we get no token saved by default. } @@ -428,7 +428,7 @@ public function onUserAfterDelete(AfterDeleteEvent $event): void $query->bind(':profileKey', $profileKey, ParameterType::STRING); $db->setQuery($query)->execute(); - } catch (\Exception $e) { + } catch (\Exception) { // Do nothing. } } @@ -473,7 +473,7 @@ private function getTokenSeedForUser(int $userId): ?string $query->bind(':userId', $userId, ParameterType::INTEGER); return $db->setQuery($query)->loadResult(); - } catch (\Exception $e) { + } catch (\Exception) { return null; } } @@ -553,7 +553,7 @@ private function getTokenForDisplay( try { $siteSecret = $this->getApplication()->get('secret'); - } catch (\Exception $e) { + } catch (\Exception) { $siteSecret = ''; } @@ -620,7 +620,7 @@ private function hasTokenProfileFields(?int $userId): bool try { $numRows = $db->setQuery($q)->loadResult() ?? 0; - } catch (\Exception $e) { + } catch (\Exception) { return false; } diff --git a/plugins/user/token/src/Field/JoomlatokenField.php b/plugins/user/token/src/Field/JoomlatokenField.php index 7de4cbc7751ae..5aa1570344b9b 100644 --- a/plugins/user/token/src/Field/JoomlatokenField.php +++ b/plugins/user/token/src/Field/JoomlatokenField.php @@ -104,7 +104,7 @@ private function getTokenForDisplay(string $tokenSeed): string try { $siteSecret = Factory::getApplication()->get('secret'); - } catch (\Exception $e) { + } catch (\Exception) { $siteSecret = ''; }