diff --git a/libraries/src/Access/Access.php b/libraries/src/Access/Access.php index ccf48cf014065..f8a8ae036624f 100644 --- a/libraries/src/Access/Access.php +++ b/libraries/src/Access/Access.php @@ -1044,7 +1044,7 @@ public static function getActionsFromData($data, $xpath = "/access/section[@name if (\is_string($data)) { try { $data = new \SimpleXMLElement($data); - } catch (\Exception $e) { + } catch (\Exception) { return false; } diff --git a/libraries/src/Application/CMSApplication.php b/libraries/src/Application/CMSApplication.php index 385936d8ecfaa..c285d5a9443c9 100644 --- a/libraries/src/Application/CMSApplication.php +++ b/libraries/src/Application/CMSApplication.php @@ -498,7 +498,7 @@ public function getCfg($varname, $default = null) Log::WARNING, 'deprecated' ); - } catch (\RuntimeException $exception) { + } catch (\RuntimeException) { // Informational log only } diff --git a/libraries/src/Application/ConsoleApplication.php b/libraries/src/Application/ConsoleApplication.php index 5941c4225c993..bb68e31ef43d4 100644 --- a/libraries/src/Application/ConsoleApplication.php +++ b/libraries/src/Application/ConsoleApplication.php @@ -525,7 +525,7 @@ protected function populateHttpHost() */ try { $uri = Uri::getInstance($liveSite); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $uri = Uri::getInstance('https://joomla.invalid/set/by/console/application'); } diff --git a/libraries/src/Application/DaemonApplication.php b/libraries/src/Application/DaemonApplication.php index b7d11dd3e86df..8be8a9987401e 100644 --- a/libraries/src/Application/DaemonApplication.php +++ b/libraries/src/Application/DaemonApplication.php @@ -517,7 +517,7 @@ protected function daemonize() $this->processId = (int) posix_getpid(); $this->parentId = $this->processId; } - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { Log::add('Unable to fork.', Log::EMERGENCY); return false; diff --git a/libraries/src/Application/EventAware.php b/libraries/src/Application/EventAware.php index ff78555627a7c..2617effb67f79 100644 --- a/libraries/src/Application/EventAware.php +++ b/libraries/src/Application/EventAware.php @@ -60,7 +60,7 @@ public function registerEvent($event, callable $handler) { try { $this->getDispatcher()->addListener($event, $handler); - } catch (\UnexpectedValueException $e) { + } catch (\UnexpectedValueException) { // No dispatcher is registered, don't throw an error (mimics old behavior) } @@ -93,7 +93,7 @@ public function triggerEvent($eventName, $args = []) { try { $dispatcher = $this->getDispatcher(); - } catch (\UnexpectedValueException $exception) { + } catch (\UnexpectedValueException) { $this->getLogger()->error(\sprintf('Dispatcher not set in %s, cannot trigger events.', \get_class($this))); return []; diff --git a/libraries/src/Application/MultiFactorAuthenticationHandler.php b/libraries/src/Application/MultiFactorAuthenticationHandler.php index 049ca9fd6afcc..e41486964323a 100644 --- a/libraries/src/Application/MultiFactorAuthenticationHandler.php +++ b/libraries/src/Application/MultiFactorAuthenticationHandler.php @@ -59,7 +59,7 @@ protected function isHandlingMultiFactorAuthentication(): bool // Multi-factor Authentication checks take place only for logged in users. try { $user = $this->getIdentity(); - } catch (\Exception $e) { + } catch (\Exception) { return false; } @@ -255,7 +255,7 @@ private function needsMultiFactorAuthenticationRedirection(): bool // Make sure we are logged in try { $user = $this->getIdentity(); - } catch (\Exception $e) { + } catch (\Exception) { // This would happen if we are in CLI or under an old Joomla! version. Either case is not supported. return false; } @@ -356,7 +356,7 @@ private function hasRejectedMultiFactorAuthenticationSetup(): bool try { $result = $db->setQuery($query)->loadResult(); - } catch (\Exception $e) { + } catch (\Exception) { $result = 1; } @@ -491,7 +491,7 @@ private function decryptLegacyTFAString(string $secret, string $stringToDecrypt) // Is this already decrypted? try { $decrypted = @json_decode($stringToDecrypt, true); - } catch (\Exception $e) { + } catch (\Exception) { $decrypted = null; } diff --git a/libraries/src/Cache/CacheController.php b/libraries/src/Cache/CacheController.php index 2c446ebe29df1..038d1e321d602 100644 --- a/libraries/src/Cache/CacheController.php +++ b/libraries/src/Cache/CacheController.php @@ -103,7 +103,7 @@ public static function getInstance($type = 'output', $options = []) try { return Factory::getContainer()->get(CacheControllerFactoryInterface::class)->createCacheController($type, $options); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $type = strtolower(preg_replace('/[^A-Z0-9_\.-]/i', '', $type)); $class = 'JCacheController' . ucfirst($type); diff --git a/libraries/src/Cache/Storage/RedisStorage.php b/libraries/src/Cache/Storage/RedisStorage.php index cc46792760ee5..3f97b700a7ede 100644 --- a/libraries/src/Cache/Storage/RedisStorage.php +++ b/libraries/src/Cache/Storage/RedisStorage.php @@ -129,7 +129,7 @@ protected function getConnection() try { static::$_redis->ping(); - } catch (\RedisException $e) { + } catch (\RedisException) { static::$_redis = null; throw new CacheConnectingException('Redis ping failed', 500); diff --git a/libraries/src/Captcha/Google/HttpBridgePostRequestMethod.php b/libraries/src/Captcha/Google/HttpBridgePostRequestMethod.php index 7b265138afca0..acee2c848c368 100644 --- a/libraries/src/Captcha/Google/HttpBridgePostRequestMethod.php +++ b/libraries/src/Captcha/Google/HttpBridgePostRequestMethod.php @@ -69,7 +69,7 @@ public function submit(RequestParameters $params) $response = $this->http->post(self::SITE_VERIFY_URL, $params->toArray()); return (string) $response->getBody(); - } catch (InvalidResponseCodeException $exception) { + } catch (InvalidResponseCodeException) { return ''; } } diff --git a/libraries/src/Categories/Categories.php b/libraries/src/Categories/Categories.php index dcd19bbcd1f07..f961dc720043b 100644 --- a/libraries/src/Categories/Categories.php +++ b/libraries/src/Categories/Categories.php @@ -157,7 +157,7 @@ public static function getInstance($extension, $options = []) if ($component instanceof CategoryServiceInterface) { $categories = $component->getCategory($options, \count($parts) > 1 ? $parts[1] : ''); } - } catch (SectionNotFoundException $e) { + } catch (SectionNotFoundException) { $categories = null; } @@ -236,7 +236,7 @@ protected function _load($id) { try { $db = $this->getDatabase(); - } catch (DatabaseNotFoundException $e) { + } catch (DatabaseNotFoundException) { @trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); $db = Factory::getContainer()->get(DatabaseInterface::class); } diff --git a/libraries/src/Changelog/Changelog.php b/libraries/src/Changelog/Changelog.php index ef21696991ab0..dbe0561a9766e 100644 --- a/libraries/src/Changelog/Changelog.php +++ b/libraries/src/Changelog/Changelog.php @@ -354,7 +354,7 @@ public function loadFromXml($url) try { $http = HttpFactory::getHttp($httpOption); $response = $http->get($url); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $response = null; } diff --git a/libraries/src/Component/ComponentHelper.php b/libraries/src/Component/ComponentHelper.php index 0c127d3087d60..eb508008a035d 100644 --- a/libraries/src/Component/ComponentHelper.php +++ b/libraries/src/Component/ComponentHelper.php @@ -408,7 +408,7 @@ protected static function load() try { static::$components = $cache->get($loader, [], __METHOD__); - } catch (CacheExceptionInterface $e) { + } catch (CacheExceptionInterface) { static::$components = $loader(); } diff --git a/libraries/src/Console/FinderIndexCommand.php b/libraries/src/Console/FinderIndexCommand.php index 9c594e9e026ac..66d7ebed1b5dc 100644 --- a/libraries/src/Console/FinderIndexCommand.php +++ b/libraries/src/Console/FinderIndexCommand.php @@ -245,7 +245,7 @@ private function configureIO(InputInterface $input, OutputInterface $output): vo try { $language = $this->getLanguage(); - } catch (\UnexpectedValueException $e) { + } catch (\UnexpectedValueException) { @trigger_error(\sprintf('Language must be set in 6.0 in %s', __METHOD__), E_USER_DEPRECATED); $language = Factory::getLanguage(); } diff --git a/libraries/src/Console/SiteCreatePublicFolderCommand.php b/libraries/src/Console/SiteCreatePublicFolderCommand.php index d4ddc024d4cf5..bc5f64b941d44 100644 --- a/libraries/src/Console/SiteCreatePublicFolderCommand.php +++ b/libraries/src/Console/SiteCreatePublicFolderCommand.php @@ -89,7 +89,7 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in try { (new PublicFolderGeneratorHelper())->createPublicFolder($this->publicFolder); - } catch (\Exception $e) { + } catch (\Exception) { return Command::FAILURE; } diff --git a/libraries/src/Crypt/Cipher/CryptoCipher.php b/libraries/src/Crypt/Cipher/CryptoCipher.php index 5c4b25c2e2133..8a353f9bf3493 100644 --- a/libraries/src/Crypt/Cipher/CryptoCipher.php +++ b/libraries/src/Crypt/Cipher/CryptoCipher.php @@ -124,7 +124,7 @@ public static function isSupported(): bool \Crypto::RuntimeTest(); return true; - } catch (\CryptoTestFailedException $e) { + } catch (\CryptoTestFailedException) { return false; } } diff --git a/libraries/src/Exception/ExceptionHandler.php b/libraries/src/Exception/ExceptionHandler.php index c8816c941511e..84aa52a7beefb 100644 --- a/libraries/src/Exception/ExceptionHandler.php +++ b/libraries/src/Exception/ExceptionHandler.php @@ -44,7 +44,7 @@ public static function handleUserDeprecatedErrors(int $errorNumber, string $erro if ($errorNumber === E_USER_DEPRECATED) { try { Log::add("$errorMessage - $errorFile - Line $errorLine", Log::WARNING, 'deprecated'); - } catch (\Exception $e) { + } catch (\Exception) { // Silence } @@ -115,7 +115,7 @@ public static function render(\Throwable $error) try { $renderer = AbstractRenderer::getRenderer($format); - } catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException) { // Default to the HTML renderer $renderer = AbstractRenderer::getRenderer('html'); } @@ -225,7 +225,7 @@ protected static function logException(\Throwable $error) Log::CRITICAL, 'error' ); - } catch (\Throwable $e) { + } catch (\Throwable) { // Logging failed, don't make a stink about it though } } diff --git a/libraries/src/Form/Field/ContenttypeField.php b/libraries/src/Form/Field/ContenttypeField.php index 5477f799a33a8..f12cbc8973acd 100644 --- a/libraries/src/Form/Field/ContenttypeField.php +++ b/libraries/src/Form/Field/ContenttypeField.php @@ -80,7 +80,7 @@ protected function getOptions() try { $options = $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return []; } diff --git a/libraries/src/Form/Field/MenuitemField.php b/libraries/src/Form/Field/MenuitemField.php index 424a772955b53..4dfc8174493a5 100644 --- a/libraries/src/Form/Field/MenuitemField.php +++ b/libraries/src/Form/Field/MenuitemField.php @@ -185,7 +185,7 @@ protected function getGroups() try { $menuTitle = $db->loadResult(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $menuTitle = $menuType; } diff --git a/libraries/src/Form/Field/SqlField.php b/libraries/src/Form/Field/SqlField.php index 9a3893cdc2519..efb1e319e8df7 100644 --- a/libraries/src/Form/Field/SqlField.php +++ b/libraries/src/Form/Field/SqlField.php @@ -291,7 +291,7 @@ protected function getOptions() try { $items = $db->loadObjectList(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { Factory::getApplication()->enqueueMessage(Text::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); } } diff --git a/libraries/src/Form/Field/TagField.php b/libraries/src/Form/Field/TagField.php index e81b268d5678a..9d0109a401aa6 100644 --- a/libraries/src/Form/Field/TagField.php +++ b/libraries/src/Form/Field/TagField.php @@ -209,7 +209,7 @@ protected function getOptions() try { $options = $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return []; } @@ -232,7 +232,7 @@ protected function getOptions() try { $options = array_merge($options, $db->loadObjectList()); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return []; } } diff --git a/libraries/src/Form/Form.php b/libraries/src/Form/Form.php index ccc34ab7c6a54..aa043c8ee37de 100644 --- a/libraries/src/Form/Form.php +++ b/libraries/src/Form/Form.php @@ -601,7 +601,7 @@ public function load($data, $replace = true, $xpath = null) if (\is_string($data)) { try { $data = new \SimpleXMLElement($data); - } catch (\Exception $e) { + } catch (\Exception) { return false; } } @@ -1465,7 +1465,7 @@ protected function loadField($element, $group = null, $value = null) if ($field instanceof DatabaseAwareInterface) { try { $field->setDatabase($this->getDatabase()); - } catch (DatabaseNotFoundException $e) { + } catch (DatabaseNotFoundException) { @trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); $field->setDatabase(Factory::getContainer()->get(DatabaseInterface::class)); } diff --git a/libraries/src/Form/FormField.php b/libraries/src/Form/FormField.php index c0c0c9274662f..ad9c253c5260f 100644 --- a/libraries/src/Form/FormField.php +++ b/libraries/src/Form/FormField.php @@ -1217,7 +1217,7 @@ public function validate($value, $group = null, ?Registry $input = null) if ($rule instanceof DatabaseAwareInterface) { try { $rule->setDatabase($this->getDatabase()); - } catch (DatabaseNotFoundException $e) { + } catch (DatabaseNotFoundException) { @trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); $rule->setDatabase(Factory::getContainer()->get(DatabaseInterface::class)); } @@ -1242,7 +1242,7 @@ public function validate($value, $group = null, ?Registry $input = null) if ($rule instanceof DatabaseAwareInterface) { try { $rule->setDatabase($this->getDatabase()); - } catch (DatabaseNotFoundException $e) { + } catch (DatabaseNotFoundException) { @trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); $rule->setDatabase(Factory::getContainer()->get(DatabaseInterface::class)); } diff --git a/libraries/src/Form/Rule/CalendarRule.php b/libraries/src/Form/Rule/CalendarRule.php index 243b8d8761a2f..584e2943531b2 100644 --- a/libraries/src/Form/Rule/CalendarRule.php +++ b/libraries/src/Form/Rule/CalendarRule.php @@ -56,7 +56,7 @@ public function test(\SimpleXMLElement $element, $value, $group = null, ?Registr try { return Factory::getDate($value) instanceof Date; - } catch (\Exception $e) { + } catch (\Exception) { return false; } } diff --git a/libraries/src/Form/Rule/FilePathRule.php b/libraries/src/Form/Rule/FilePathRule.php index 884e318f39dd5..63ee9daef96b4 100644 --- a/libraries/src/Form/Rule/FilePathRule.php +++ b/libraries/src/Form/Rule/FilePathRule.php @@ -70,7 +70,7 @@ public function test(\SimpleXMLElement $element, $value, $group = null, ?Registr // Check if $value is a valid path, which includes not allowing to break out of the current path try { Path::check($value); - } catch (\Exception $e) { + } catch (\Exception) { // When there is an exception in the check path this is not valid return false; } diff --git a/libraries/src/Helper/AuthenticationHelper.php b/libraries/src/Helper/AuthenticationHelper.php index 7941fa8f30077..de5e00aa1c9af 100644 --- a/libraries/src/Helper/AuthenticationHelper.php +++ b/libraries/src/Helper/AuthenticationHelper.php @@ -93,7 +93,7 @@ public static function getLoginButtons(string $formId): array // Get all the User plugins. $dispatcher = Factory::getApplication()->getDispatcher(); PluginHelper::importPlugin('user', null, true, $dispatcher); - } catch (\Exception $e) { + } catch (\Exception) { return []; } diff --git a/libraries/src/Helper/LibraryHelper.php b/libraries/src/Helper/LibraryHelper.php index fccd82af535f3..6c17ed4d1bc50 100644 --- a/libraries/src/Helper/LibraryHelper.php +++ b/libraries/src/Helper/LibraryHelper.php @@ -164,7 +164,7 @@ protected static function loadLibrary($element) try { static::$libraries[$element] = $cache->get($loader, [$element], __METHOD__ . $element); - } catch (CacheExceptionInterface $e) { + } catch (CacheExceptionInterface) { static::$libraries[$element] = $loader($element); } diff --git a/libraries/src/Helper/MediaHelper.php b/libraries/src/Helper/MediaHelper.php index 4b6ba22886464..9e3d40e0d3524 100644 --- a/libraries/src/Helper/MediaHelper.php +++ b/libraries/src/Helper/MediaHelper.php @@ -103,7 +103,7 @@ public static function getMimeType($file, $isImage = false) $mime = finfo_file($finfo, $file); finfo_close($finfo); } - } catch (\Exception $e) { + } catch (\Exception) { // If we have any kind of error here => false; return false; } diff --git a/libraries/src/Helper/ModuleHelper.php b/libraries/src/Helper/ModuleHelper.php index 4a92863884e51..c8a684f6ebeae 100644 --- a/libraries/src/Helper/ModuleHelper.php +++ b/libraries/src/Helper/ModuleHelper.php @@ -334,7 +334,7 @@ public static function getLayoutPath($module, $layout = 'default') $tPath = Path::check(JPATH_THEMES . '/' . $template . '/html/' . $module . '/' . $layout . '.php'); $iPath = Path::check(JPATH_THEMES . '/' . $templateObj->parent . '/html/' . $module . '/' . $layout . '.php'); $bPath = Path::check(JPATH_BASE . '/modules/' . $module . '/tmpl/' . $defaultLayout . '.php'); - } catch (\Exception $e) { + } catch (\Exception) { // On error fallback to the default path return $dPath; } diff --git a/libraries/src/Helper/TagsHelper.php b/libraries/src/Helper/TagsHelper.php index 8eaf8a6956d5a..491675fc739a2 100644 --- a/libraries/src/Helper/TagsHelper.php +++ b/libraries/src/Helper/TagsHelper.php @@ -194,7 +194,7 @@ public static function convertPathsToNames($tags) try { $aliasesMapper = $db->loadAssocList('alias'); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return false; } @@ -1001,7 +1001,7 @@ public static function searchTags($filters = []) try { $results = $db->loadObjectList(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return []; } diff --git a/libraries/src/Installer/Adapter/ComponentAdapter.php b/libraries/src/Installer/Adapter/ComponentAdapter.php index 03be708a35706..d8214ad3abe63 100644 --- a/libraries/src/Installer/Adapter/ComponentAdapter.php +++ b/libraries/src/Installer/Adapter/ComponentAdapter.php @@ -1245,7 +1245,7 @@ protected function _updateMenus($componentId, $clientId = null) try { $db->setQuery($query); $db->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return false; } @@ -1369,7 +1369,7 @@ public function refreshManifestCache() try { return $this->parent->extension->store(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { Log::add(Text::_('JLIB_INSTALLER_ERROR_COMP_REFRESH_MANIFEST_CACHE'), Log::WARNING, 'jerror'); return false; diff --git a/libraries/src/Installer/Adapter/FileAdapter.php b/libraries/src/Installer/Adapter/FileAdapter.php index 0d8b233e75f82..94bf439616450 100644 --- a/libraries/src/Installer/Adapter/FileAdapter.php +++ b/libraries/src/Installer/Adapter/FileAdapter.php @@ -466,7 +466,7 @@ protected function extensionExistsInSystem($extension = null) try { $db->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { // Install failed, rollback changes - error logged by the installer return false; } @@ -589,7 +589,7 @@ public function refreshManifestCache() try { return $this->parent->extension->store(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { Log::add(Text::_('JLIB_INSTALLER_ERROR_PACK_REFRESH_MANIFEST_CACHE'), Log::WARNING, 'jerror'); return false; diff --git a/libraries/src/Installer/Adapter/LanguageAdapter.php b/libraries/src/Installer/Adapter/LanguageAdapter.php index 9333350f572d4..ee220fdac5114 100644 --- a/libraries/src/Installer/Adapter/LanguageAdapter.php +++ b/libraries/src/Installer/Adapter/LanguageAdapter.php @@ -700,7 +700,7 @@ public function discover_install() try { $this->parent->extension->check(); $this->parent->extension->store(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { Log::add(Text::_('JLIB_INSTALLER_ERROR_LANG_DISCOVER_STORE_DETAILS'), Log::WARNING, 'jerror'); return false; diff --git a/libraries/src/Installer/Adapter/LibraryAdapter.php b/libraries/src/Installer/Adapter/LibraryAdapter.php index d55a4918051cd..b02cd13080c0e 100644 --- a/libraries/src/Installer/Adapter/LibraryAdapter.php +++ b/libraries/src/Installer/Adapter/LibraryAdapter.php @@ -498,7 +498,7 @@ public function refreshManifestCache() try { return $this->parent->extension->store(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { Log::add(Text::_('JLIB_INSTALLER_ERROR_LIB_REFRESH_MANIFEST_CACHE'), Log::WARNING, 'jerror'); return false; diff --git a/libraries/src/Installer/Adapter/ModuleAdapter.php b/libraries/src/Installer/Adapter/ModuleAdapter.php index f31fcb8807358..595dd360c72a4 100644 --- a/libraries/src/Installer/Adapter/ModuleAdapter.php +++ b/libraries/src/Installer/Adapter/ModuleAdapter.php @@ -288,7 +288,7 @@ protected function finaliseUninstall(): bool try { // Clean up any other ones that might exist as well $db->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { // Ignore the error... } @@ -677,7 +677,7 @@ protected function _rollback_menu($arg) try { return $db->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return false; } } @@ -708,7 +708,7 @@ protected function _rollback_module($arg) try { return $db->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { return false; } } diff --git a/libraries/src/Installer/Adapter/PackageAdapter.php b/libraries/src/Installer/Adapter/PackageAdapter.php index d6e441dd1c702..0f036f853a307 100644 --- a/libraries/src/Installer/Adapter/PackageAdapter.php +++ b/libraries/src/Installer/Adapter/PackageAdapter.php @@ -230,7 +230,7 @@ protected function finaliseInstall() try { $db->setQuery($query)->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { Log::add(Text::_('JLIB_INSTALLER_ERROR_PACK_SETTING_PACKAGE_ID'), Log::WARNING, 'jerror'); } } @@ -723,7 +723,7 @@ public function refreshManifestCache() try { return $this->parent->extension->store(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { Log::add(Text::_('JLIB_INSTALLER_ERROR_PACK_REFRESH_MANIFEST_CACHE'), Log::WARNING, 'jerror'); return false; diff --git a/libraries/src/Installer/Adapter/TemplateAdapter.php b/libraries/src/Installer/Adapter/TemplateAdapter.php index 07823c741bd1a..b3f4444736c54 100644 --- a/libraries/src/Installer/Adapter/TemplateAdapter.php +++ b/libraries/src/Installer/Adapter/TemplateAdapter.php @@ -681,7 +681,7 @@ public function refreshManifestCache() try { return $this->parent->extension->store(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { Log::add(Text::_('JLIB_INSTALLER_ERROR_TPL_REFRESH_MANIFEST_CACHE'), Log::WARNING, 'jerror'); return false; diff --git a/libraries/src/Installer/Installer.php b/libraries/src/Installer/Installer.php index b18418bf9f9b7..c0004580d9a68 100644 --- a/libraries/src/Installer/Installer.php +++ b/libraries/src/Installer/Installer.php @@ -564,7 +564,7 @@ public function abort($msg = null, $type = null) $db->execute(); $stepval = true; - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { // The database API will have already logged the error it caught, we just need to alert the user to the issue Log::add(Text::_('JLIB_INSTALLER_ABORT_ERROR_DELETING_EXTENSIONS_RECORD'), Log::WARNING, 'jerror'); @@ -1351,7 +1351,7 @@ protected function updateSchemaTable(int $eid, string $version, bool $update = f } else { $db->insertObject('#__schemas', $o); } - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { /** * Safe fallback: delete any existing record and insert afresh. * diff --git a/libraries/src/Installer/InstallerHelper.php b/libraries/src/Installer/InstallerHelper.php index 5f68dc4998ac5..33812eb84cc60 100644 --- a/libraries/src/Installer/InstallerHelper.php +++ b/libraries/src/Installer/InstallerHelper.php @@ -166,7 +166,7 @@ public static function unpack($packageFilename, $alwaysReturnArray = false) try { $archive = new Archive(['tmp_path' => Factory::getApplication()->get('tmp_path')]); $extract = $archive->extract($archivename, $extractdir); - } catch (\Exception $e) { + } catch (\Exception) { if ($alwaysReturnArray) { return [ 'extractdir' => null, diff --git a/libraries/src/Installer/LegacyInstallerScript.php b/libraries/src/Installer/LegacyInstallerScript.php index 51a95e46dcf35..df655e9959708 100644 --- a/libraries/src/Installer/LegacyInstallerScript.php +++ b/libraries/src/Installer/LegacyInstallerScript.php @@ -179,7 +179,7 @@ private function callOnScript(string $name, array $arguments): bool if ($this->installerScript instanceof DatabaseAwareInterface) { try { $this->installerScript->setDatabase($this->getDatabase()); - } catch (DatabaseNotFoundException $e) { + } catch (DatabaseNotFoundException) { @trigger_error(\sprintf('Database must be set, this will not be caught anymore in 6.0 in %s.', __METHOD__), E_USER_DEPRECATED); $this->installerScript->setDatabase(Factory::getContainer()->get(DatabaseInterface::class)); } diff --git a/libraries/src/Language/LanguageHelper.php b/libraries/src/Language/LanguageHelper.php index dd266755c012d..0a366ece2ed7a 100644 --- a/libraries/src/Language/LanguageHelper.php +++ b/libraries/src/Language/LanguageHelper.php @@ -281,7 +281,7 @@ public static function getInstalledLanguages( if ($processMetaData) { try { $lang->metadata = self::parseXMLLanguageFile($metafile); - } catch (\Exception $e) { + } catch (\Exception) { // Not able to process xml language file. Fail silently. Log::add(Text::sprintf('JLIB_LANGUAGE_ERROR_CANNOT_LOAD_METAFILE', $language->element, $metafile), Log::WARNING, 'language'); @@ -300,7 +300,7 @@ public static function getInstalledLanguages( if ($processManifest) { try { $lang->manifest = Installer::parseXMLInstallFile($metafile); - } catch (\Exception $e) { + } catch (\Exception) { // Not able to process xml language file. Fail silently. Log::add(Text::sprintf('JLIB_LANGUAGE_ERROR_CANNOT_LOAD_METAFILE', $language->element, $metafile), Log::WARNING, 'language'); @@ -626,7 +626,7 @@ public static function parseLanguageFiles($dir = null) if ($metadata = self::parseXMLLanguageFile($file)) { $languages = array_replace($languages, [$dirPathParts['filename'] => $metadata]); } - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { // Ignore it } } diff --git a/libraries/src/MVC/Controller/BaseController.php b/libraries/src/MVC/Controller/BaseController.php index 2c7b838ae053d..ddae3e9683984 100644 --- a/libraries/src/MVC/Controller/BaseController.php +++ b/libraries/src/MVC/Controller/BaseController.php @@ -690,7 +690,7 @@ public function display($cachable = false, $urlparams = []) /** @var \Joomla\CMS\Cache\Controller\ViewController $cache */ $cache = Factory::getCache($option, 'view'); $cache->get($view, 'display'); - } catch (CacheExceptionInterface $exception) { + } catch (CacheExceptionInterface) { $view->display(); } } else { diff --git a/libraries/src/MVC/Factory/MVCFactory.php b/libraries/src/MVC/Factory/MVCFactory.php index a0282f2b4d69b..35fe905b69ee0 100644 --- a/libraries/src/MVC/Factory/MVCFactory.php +++ b/libraries/src/MVC/Factory/MVCFactory.php @@ -170,7 +170,7 @@ public function createModel($name, $prefix = '', array $config = []) if ($model instanceof DatabaseAwareInterface) { try { $model->setDatabase($this->getDatabase()); - } catch (DatabaseNotFoundException $e) { + } catch (DatabaseNotFoundException) { @trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); $model->setDatabase(Factory::getContainer()->get(DatabaseInterface::class)); } @@ -266,7 +266,7 @@ public function createTable($name, $prefix = '', array $config = []) try { $db = \array_key_exists('dbo', $config) ? $config['dbo'] : $this->getDatabase(); - } catch (DatabaseNotFoundException $e) { + } catch (DatabaseNotFoundException) { @trigger_error(\sprintf('Database must be set, this will not be caught anymore in 5.0.'), E_USER_DEPRECATED); $db = Factory::getContainer()->get(DatabaseInterface::class); } @@ -320,7 +320,7 @@ private function setFormFactoryOnObject($object) try { $object->setFormFactory($this->getFormFactory()); - } catch (\UnexpectedValueException $e) { + } catch (\UnexpectedValueException) { // Ignore it } } @@ -342,7 +342,7 @@ private function setDispatcherOnObject($object) try { $object->setDispatcher($this->getDispatcher()); - } catch (\UnexpectedValueException $e) { + } catch (\UnexpectedValueException) { // Ignore it } } @@ -364,7 +364,7 @@ private function setRouterOnObject($object): void try { $object->setSiteRouter($this->getSiteRouter()); - } catch (\UnexpectedValueException $e) { + } catch (\UnexpectedValueException) { // Ignore it } } @@ -386,7 +386,7 @@ private function setCacheControllerOnObject($object): void try { $object->setCacheControllerFactory($this->getCacheControllerFactory()); - } catch (\UnexpectedValueException $e) { + } catch (\UnexpectedValueException) { // Ignore it } } @@ -408,7 +408,7 @@ private function setUserFactoryOnObject($object): void try { $object->setUserFactory($this->getUserFactory()); - } catch (\UnexpectedValueException $e) { + } catch (\UnexpectedValueException) { // Ignore it } } @@ -430,7 +430,7 @@ private function setMailerFactoryOnObject($object): void try { $object->setMailerFactory($this->getMailerFactory()); - } catch (\UnexpectedValueException $e) { + } catch (\UnexpectedValueException) { // Ignore it } } diff --git a/libraries/src/MVC/Model/BaseDatabaseModel.php b/libraries/src/MVC/Model/BaseDatabaseModel.php index 5ac17120cb903..e7dbc8e27dfa2 100644 --- a/libraries/src/MVC/Model/BaseDatabaseModel.php +++ b/libraries/src/MVC/Model/BaseDatabaseModel.php @@ -311,7 +311,7 @@ protected function cleanCache($group = null) /** @var CallbackController $cache */ $cache = $this->getCacheControllerFactory()->createCacheController('callback', $options); $cache->clean(); - } catch (CacheExceptionInterface $exception) { + } catch (CacheExceptionInterface) { $options['result'] = false; } @@ -398,7 +398,7 @@ public function getDbo() { try { return $this->getDatabase(); - } catch (DatabaseNotFoundException $e) { + } catch (DatabaseNotFoundException) { throw new \UnexpectedValueException('Database driver not set in ' . __CLASS__); } } diff --git a/libraries/src/MVC/Model/FormBehaviorTrait.php b/libraries/src/MVC/Model/FormBehaviorTrait.php index b83e3d241ea3e..6ff8b6452b13e 100644 --- a/libraries/src/MVC/Model/FormBehaviorTrait.php +++ b/libraries/src/MVC/Model/FormBehaviorTrait.php @@ -82,7 +82,7 @@ protected function loadForm($name, $source = null, $options = [], $clear = false try { $formFactory = $this->getFormFactory(); - } catch (\UnexpectedValueException $e) { + } catch (\UnexpectedValueException) { $formFactory = Factory::getContainer()->get(FormFactoryInterface::class); } diff --git a/libraries/src/MVC/Model/ListModel.php b/libraries/src/MVC/Model/ListModel.php index 2b5196b072bc3..f3c117021fa4a 100644 --- a/libraries/src/MVC/Model/ListModel.php +++ b/libraries/src/MVC/Model/ListModel.php @@ -429,7 +429,7 @@ public function getFilterForm($data = [], $loadData = true) try { // Get the form. return $this->loadForm($this->context . '.filter', $this->filterFormName, ['control' => '', 'load_data' => $loadData]); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { } return null; diff --git a/libraries/src/Mail/MailerFactory.php b/libraries/src/Mail/MailerFactory.php index fc91e620b6967..4efae62a2d5ab 100644 --- a/libraries/src/Mail/MailerFactory.php +++ b/libraries/src/Mail/MailerFactory.php @@ -82,7 +82,7 @@ public function createMailer(?Registry $settings = null): MailerInterface if ($mailer->setFrom($mailfrom, MailHelper::cleanLine($fromname), false) === false) { Log::add(__METHOD__ . '() could not set the sender data.', Log::WARNING, 'mail'); } - } catch (\Exception $e) { + } catch (\Exception) { Log::add(__METHOD__ . '() could not set the sender data.', Log::WARNING, 'mail'); } } diff --git a/libraries/src/Menu/MenuItem.php b/libraries/src/Menu/MenuItem.php index f621ea72df0e1..ceb479bb8ad22 100644 --- a/libraries/src/Menu/MenuItem.php +++ b/libraries/src/Menu/MenuItem.php @@ -222,7 +222,7 @@ public function getParams() if (!($this->params instanceof Registry)) { try { $this->params = new Registry($this->params); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { /* * Joomla shipped with a broken sample json string for 4 years which caused fatals with new * error checks. So for now we catch the exception here - but one day we should remove it and require diff --git a/libraries/src/Menu/SiteMenu.php b/libraries/src/Menu/SiteMenu.php index a0dba70a0943c..8abedbe60af73 100644 --- a/libraries/src/Menu/SiteMenu.php +++ b/libraries/src/Menu/SiteMenu.php @@ -177,7 +177,7 @@ public function load() $cache = $this->getCacheControllerFactory()->createCacheController('callback', ['defaultgroup' => 'com_menus']); $this->items = $cache->get($loader, [], md5(\get_class($this)), false); - } catch (CacheExceptionInterface $e) { + } catch (CacheExceptionInterface) { try { $this->items = $loader(); } catch (ExecutionFailureException $databaseException) { diff --git a/libraries/src/Plugin/PluginHelper.php b/libraries/src/Plugin/PluginHelper.php index 9977628cc163d..f32b998b191c3 100644 --- a/libraries/src/Plugin/PluginHelper.php +++ b/libraries/src/Plugin/PluginHelper.php @@ -296,7 +296,7 @@ protected static function load() try { static::$plugins = $cache->get($loader, [], md5(implode(',', $levels)), false); - } catch (CacheExceptionInterface $cacheException) { + } catch (CacheExceptionInterface) { static::$plugins = $loader(); } diff --git a/libraries/src/Router/ApiRouter.php b/libraries/src/Router/ApiRouter.php index c10cfe396bbb9..d3431a0bc44fb 100644 --- a/libraries/src/Router/ApiRouter.php +++ b/libraries/src/Router/ApiRouter.php @@ -144,7 +144,7 @@ public function getRoutePath() */ try { $baseUri = Uri::base(true); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $baseUri = ''; } diff --git a/libraries/src/Router/Route.php b/libraries/src/Router/Route.php index e28a371610a4f..f4e2cdd238b3f 100644 --- a/libraries/src/Router/Route.php +++ b/libraries/src/Router/Route.php @@ -97,7 +97,7 @@ public static function _($url, $xhtml = true, $tls = self::TLS_IGNORE, $absolute $client = $app->getName(); return static::link($client, $url, $xhtml, $tls, $absolute); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { /** * @deprecated 3.9 this method will not fail silently from 6.0 * Before 3.9.0 this method failed silently on router error. This B/C will be removed in Joomla 6.0 @@ -136,7 +136,7 @@ public static function link($client, $url, $xhtml = true, $tls = self::TLS_IGNOR if ($client && !isset(self::$_router[$client])) { try { self::$_router[$client] = Factory::getContainer()->get(ucfirst($client) . 'Router') ?: Factory::getApplication()::getRouter($client); - } catch (KeyNotFoundException $e) { + } catch (KeyNotFoundException) { self::$_router[$client] = Factory::getApplication()::getRouter($client); } } diff --git a/libraries/src/Router/SiteRouter.php b/libraries/src/Router/SiteRouter.php index c94eb40d6a6d7..b5c948a3bd1c3 100644 --- a/libraries/src/Router/SiteRouter.php +++ b/libraries/src/Router/SiteRouter.php @@ -138,7 +138,7 @@ public function parseInit(&$router, &$uri) */ try { $baseUri = Uri::base(true); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $baseUri = ''; } diff --git a/libraries/src/Schema/ChangeItem.php b/libraries/src/Schema/ChangeItem.php index 97d11315e1c81..19808a25c119b 100644 --- a/libraries/src/Schema/ChangeItem.php +++ b/libraries/src/Schema/ChangeItem.php @@ -236,7 +236,7 @@ public function fix() } else { $this->rerunStatus = -2; } - } catch (ExecutionFailureException | \RuntimeException $e) { + } catch (ExecutionFailureException | \RuntimeException) { $this->rerunStatus = -2; } } diff --git a/libraries/src/Session/MetadataManager.php b/libraries/src/Session/MetadataManager.php index 0c58e944bffac..6ec289f3145e0 100644 --- a/libraries/src/Session/MetadataManager.php +++ b/libraries/src/Session/MetadataManager.php @@ -158,7 +158,7 @@ public function deletePriorTo($time) try { $this->db->execute(); - } catch (ExecutionFailureException $exception) { + } catch (ExecutionFailureException) { // Since garbage collection does not result in a fatal error when run in the session API, we don't allow it here either. } } @@ -185,7 +185,7 @@ private function checkSessionRecordExists(string $sessionId): int try { $exists = $this->db->loadResult(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return self::$sessionRecordUnknown; } @@ -258,7 +258,7 @@ private function createSessionRecord(SessionInterface $session, User $user) try { $this->db->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { // This failure isn't critical, we can go on without the metadata } } @@ -314,7 +314,7 @@ private function updateSessionRecord(SessionInterface $session, User $user) try { $this->db->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { // This failure isn't critical, we can go on without the metadata } } diff --git a/libraries/src/String/PunycodeHelper.php b/libraries/src/String/PunycodeHelper.php index 48e397e56e118..0a6344bfebdb3 100644 --- a/libraries/src/String/PunycodeHelper.php +++ b/libraries/src/String/PunycodeHelper.php @@ -42,7 +42,7 @@ public static function toPunycode($utfString) { try { $converted = (new ToIdn())->convert($utfString); - } catch (AlreadyPunycodeException $e) { + } catch (AlreadyPunycodeException) { $converted = $utfString; } diff --git a/libraries/src/TUF/TufFetcher.php b/libraries/src/TUF/TufFetcher.php index d0f2e0ca0bd97..19566c801daff 100644 --- a/libraries/src/TUF/TufFetcher.php +++ b/libraries/src/TUF/TufFetcher.php @@ -127,17 +127,17 @@ public function getValidUpdate() } throw $e; } - } catch (DownloadSizeException $e) { + } catch (DownloadSizeException) { $this->app->enqueueMessage(Text::_('JLIB_INSTALLER_TUF_DOWNLOAD_SIZE'), CMSApplicationInterface::MSG_ERROR); - } catch (MetadataException $e) { + } catch (MetadataException) { $this->app->enqueueMessage(Text::_('JLIB_INSTALLER_TUF_INVALID_METADATA'), CMSApplicationInterface::MSG_ERROR); - } catch (FreezeAttackException $e) { + } catch (FreezeAttackException) { $this->app->enqueueMessage(Text::_('JLIB_INSTALLER_TUF_FREEZE_ATTACK'), CMSApplicationInterface::MSG_ERROR); - } catch (RollbackAttackException $e) { + } catch (RollbackAttackException) { $this->app->enqueueMessage(Text::_('JLIB_INSTALLER_TUF_ROLLBACK_ATTACK'), CMSApplicationInterface::MSG_ERROR); - } catch (SignatureThresholdException $e) { + } catch (SignatureThresholdException) { $this->app->enqueueMessage(Text::_('JLIB_INSTALLER_TUF_SIGNATURE_THRESHOLD'), CMSApplicationInterface::MSG_ERROR); - } catch (TufException $e) { + } catch (TufException) { $this->app->enqueueMessage(Text::_('JLIB_INSTALLER_TUF_ERROR_GENERIC'), CMSApplicationInterface::MSG_ERROR); } diff --git a/libraries/src/Table/Usergroup.php b/libraries/src/Table/Usergroup.php index a9fdc4c9e4cbc..1b4c4a23cd1dc 100644 --- a/libraries/src/Table/Usergroup.php +++ b/libraries/src/Table/Usergroup.php @@ -186,7 +186,7 @@ public function rebuild($parentId = 0, $left = 0) // If there is an update failure, return false to break out of the recursion try { $db->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { return false; } diff --git a/libraries/src/Updater/Adapter/TufAdapter.php b/libraries/src/Updater/Adapter/TufAdapter.php index 67366b92f9fa8..2bb8cb4fe4790 100644 --- a/libraries/src/Updater/Adapter/TufAdapter.php +++ b/libraries/src/Updater/Adapter/TufAdapter.php @@ -161,7 +161,7 @@ protected function processTufTarget(string $filename, array $target): bool|array try { $values = $resolver->resolve($values); - } catch (\Exception $e) { + } catch (\Exception) { return false; } diff --git a/libraries/src/Updater/Update.php b/libraries/src/Updater/Update.php index 57004bb58db05..1780fa1a4f364 100644 --- a/libraries/src/Updater/Update.php +++ b/libraries/src/Updater/Update.php @@ -643,7 +643,7 @@ public function loadFromXml($url, $minimumStability = Updater::STABILITY_STABLE, try { $http = HttpFactory::getHttp($httpOption); $response = $http->get($url); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $response = null; } diff --git a/libraries/src/Updater/UpdateAdapter.php b/libraries/src/Updater/UpdateAdapter.php index 1b4d1cc777c63..06899b779a966 100644 --- a/libraries/src/Updater/UpdateAdapter.php +++ b/libraries/src/Updater/UpdateAdapter.php @@ -164,7 +164,7 @@ protected function toggleUpdateSite($updateSiteId, $enabled = true) try { $db->execute(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { // Do nothing } } @@ -196,7 +196,7 @@ protected function getUpdateSiteName($updateSiteId) try { $name = $db->loadResult(); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { // Do nothing } @@ -262,7 +262,7 @@ protected function getUpdateSiteResponse($options = []) try { $http = HttpFactory::getHttp($httpOption); $response = $http->get($url, $headers, 20); - } catch (\RuntimeException $e) { + } catch (\RuntimeException) { $response = null; } diff --git a/libraries/src/User/UserHelper.php b/libraries/src/User/UserHelper.php index 3b8689b004a67..889066bd61d51 100644 --- a/libraries/src/User/UserHelper.php +++ b/libraries/src/User/UserHelper.php @@ -648,7 +648,7 @@ public static function destroyUserSessions($userId, $keepCurrent = false, $clien ->delete($db->quoteName('#__session')) ->whereIn($db->quoteName('session_id'), $sessionIds, ParameterType::LARGE_OBJECT) )->execute(); - } catch (ExecutionFailureException $e) { + } catch (ExecutionFailureException) { // No issue, let things go } diff --git a/libraries/src/WebAuthn/Server.php b/libraries/src/WebAuthn/Server.php index 1b86b4b37284f..a49c9f7409ce7 100644 --- a/libraries/src/WebAuthn/Server.php +++ b/libraries/src/WebAuthn/Server.php @@ -358,7 +358,7 @@ public function loadAndCheckAssertionResponse(string $data, PublicKeyCredentialR */ try { $data = @json_decode($data, true) ?? []; - } catch (\Exception $e) { + } catch (\Exception) { $data = []; } @@ -367,7 +367,7 @@ public function loadAndCheckAssertionResponse(string $data, PublicKeyCredentialR foreach (['authenticatorData', 'clientDataJSON', 'signature', 'userHandle'] as $key) { try { $value = Base64::decode($data['response'][$key] ?? ''); - } catch (\Exception $e) { + } catch (\Exception) { $value = ''; } $data['response'][$key] = Base64UrlSafe::encodeUnpadded($value); diff --git a/libraries/src/Workflow/Workflow.php b/libraries/src/Workflow/Workflow.php index ec7dcebd0e396..6eb7d8e73475f 100644 --- a/libraries/src/Workflow/Workflow.php +++ b/libraries/src/Workflow/Workflow.php @@ -446,7 +446,7 @@ public function createAssociation(int $pk, int $state): bool ->bind(':extension', $this->extension); $this->db->setQuery($query)->execute(); - } catch (\Exception $e) { + } catch (\Exception) { return false; } @@ -478,7 +478,7 @@ public function updateAssociations(array $pks, int $state): bool ->bind(':extension', $this->extension); $this->db->setQuery($query)->execute(); - } catch (\Exception $e) { + } catch (\Exception) { return false; } @@ -508,7 +508,7 @@ public function deleteAssociation(array $pks): bool ->bind(':extension', $this->extension); $this->db->setQuery($query)->execute(); - } catch (\Exception $e) { + } catch (\Exception) { return false; }