diff --git a/.rector.php b/.rector.php index d22287c7c76..2ced6c1d484 100644 --- a/.rector.php +++ b/.rector.php @@ -73,6 +73,7 @@ DeadCode\ClassMethod\RemoveUselessReturnTagRector::class, DeadCode\Property\RemoveUselessVarTagRector::class, DeadCode\StaticCall\RemoveParentCallWithoutParentRector::class, + Php80\Catch_\RemoveUnusedVariableInCatchRector::class, ]) ->withPreparedSets( deadCode: false, diff --git a/app/Mage.php b/app/Mage.php index b70808e8ec0..634a966deeb 100644 --- a/app/Mage.php +++ b/app/Mage.php @@ -703,7 +703,7 @@ public static function init($code = '', $type = 'store', $options = [], $modules } else { self::$_app->init($code, $type, $options); } - } catch (Mage_Core_Model_Session_Exception $e) { + } catch (Mage_Core_Model_Session_Exception) { header('Location: ' . self::getBaseUrl()); die; } catch (Mage_Core_Model_Store_Exception $e) { @@ -746,7 +746,7 @@ public static function run($code = '', $type = 'store', $options = []) 'options' => $options, ]); Varien_Profiler::stop('mage'); - } catch (Mage_Core_Model_Session_Exception $e) { + } catch (Mage_Core_Model_Session_Exception) { header('Location: ' . self::getBaseUrl()); die(); } catch (Mage_Core_Model_Store_Exception $e) { @@ -857,7 +857,7 @@ public static function log($message, $level = null, $file = '', $forceLog = fals if (empty($file)) { $file = self::getStoreConfig('dev/log/file'); } - } catch (Exception $e) { + } catch (Exception) { $logActive = true; } @@ -869,7 +869,7 @@ public static function log($message, $level = null, $file = '', $forceLog = fals try { $maxLogLevel = (int) self::getStoreConfig('dev/log/max_level'); - } catch (Throwable $e) { + } catch (Throwable) { $maxLogLevel = Zend_Log::DEBUG; } @@ -924,7 +924,7 @@ public static function log($message, $level = null, $file = '', $forceLog = fals $message = addcslashes($message, 'log($message, $level); - } catch (Exception $e) { + } catch (Exception) { } } diff --git a/app/code/core/Mage/Admin/Model/Acl/Role/Registry.php b/app/code/core/Mage/Admin/Model/Acl/Role/Registry.php index e4d345df2d1..68b89eb1418 100644 --- a/app/code/core/Mage/Admin/Model/Acl/Role/Registry.php +++ b/app/code/core/Mage/Admin/Model/Acl/Role/Registry.php @@ -30,7 +30,7 @@ public function addParent($role, $parents) $roleId = $role; $role = $this->get($role); } - } catch (Zend_Acl_Role_Registry_Exception $e) { + } catch (Zend_Acl_Role_Registry_Exception) { throw new Zend_Acl_Role_Registry_Exception("Child Role id '$roleId' does not exist"); } @@ -45,7 +45,7 @@ public function addParent($role, $parents) $roleParentId = $parent; } $roleParent = $this->get($roleParentId); - } catch (Zend_Acl_Role_Registry_Exception $e) { + } catch (Zend_Acl_Role_Registry_Exception) { throw new Zend_Acl_Role_Registry_Exception("Parent Role id '$roleParentId' does not exist"); } $this->_roles[$roleId]['parents'][$roleParentId] = $roleParent; diff --git a/app/code/core/Mage/Admin/Model/Resource/User.php b/app/code/core/Mage/Admin/Model/Resource/User.php index 68712653d3a..42c1ba38f6a 100644 --- a/app/code/core/Mage/Admin/Model/Resource/User.php +++ b/app/code/core/Mage/Admin/Model/Resource/User.php @@ -448,7 +448,7 @@ protected function _unserializeExtraData(Mage_Core_Model_Abstract $user) try { $unsterilizedData = Mage::helper('core/unserializeArray')->unserialize($user->getExtra()); $user->setExtra($unsterilizedData); - } catch (Exception $e) { + } catch (Exception) { $user->setExtra(false); } return $user; diff --git a/app/code/core/Mage/Admin/Model/Session.php b/app/code/core/Mage/Admin/Model/Session.php index e2e33e03d4d..f53459bc50f 100644 --- a/app/code/core/Mage/Admin/Model/Session.php +++ b/app/code/core/Mage/Admin/Model/Session.php @@ -229,12 +229,12 @@ public function isAllowed($resource, $privilege = null) try { return $acl->isAllowed($user->getAclRole(), $resource, $privilege); - } catch (Exception $e) { + } catch (Exception) { try { if (!$acl->has($resource)) { return $acl->isAllowed($user->getAclRole(), null, $privilege); } - } catch (Exception $e) { + } catch (Exception) { } } } @@ -308,7 +308,7 @@ protected function _loginFailed($e, $request, $username, $message) 'user_name' => $username, 'exception' => $e, ]); - } catch (Exception $e) { + } catch (Exception) { } if ($request && !$request->getParam('messageSent')) { diff --git a/app/code/core/Mage/AdminNotification/Model/Feed.php b/app/code/core/Mage/AdminNotification/Model/Feed.php index 8f399f323b2..22bde802559 100644 --- a/app/code/core/Mage/AdminNotification/Model/Feed.php +++ b/app/code/core/Mage/AdminNotification/Model/Feed.php @@ -144,7 +144,7 @@ public function getFeedData() try { $xml = new SimpleXMLElement($data); - } catch (Exception $e) { + } catch (Exception) { return false; } @@ -159,7 +159,7 @@ public function getFeedXml() try { $data = $this->getFeedData(); $xml = new SimpleXMLElement($data); - } catch (Exception $e) { + } catch (Exception) { $xml = new SimpleXMLElement(''); } diff --git a/app/code/core/Mage/Adminhtml/Block/Page/Menu.php b/app/code/core/Mage/Adminhtml/Block/Page/Menu.php index c713d6e5782..1f6e25eec64 100644 --- a/app/code/core/Mage/Adminhtml/Block/Page/Menu.php +++ b/app/code/core/Mage/Adminhtml/Block/Page/Menu.php @@ -214,7 +214,7 @@ protected function _checkAcl($resource) { try { $res = Mage::getSingleton('admin/session')->isAllowed($resource); - } catch (Exception $e) { + } catch (Exception) { return false; } return $res; diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Grid.php b/app/code/core/Mage/Adminhtml/Block/Report/Grid.php index 52ba2298875..f794cf6bdac 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Grid.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Grid.php @@ -150,7 +150,7 @@ protected function _prepareCollection() $to = $this->getLocale()->date($this->getFilter('report_to'), Zend_Date::DATE_SHORT, null, false); $collection->setInterval($from, $to); - } catch (Exception $e) { + } catch (Exception) { $this->_errors[] = Mage::helper('reports')->__('Invalid date specified.'); } } diff --git a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Grid/Column/Renderer/Date.php b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Grid/Column/Renderer/Date.php index 0cba9066e00..668a9fcef1d 100644 --- a/app/code/core/Mage/Adminhtml/Block/Report/Sales/Grid/Column/Renderer/Date.php +++ b/app/code/core/Mage/Adminhtml/Block/Report/Sales/Grid/Column/Renderer/Date.php @@ -42,7 +42,7 @@ protected function _getFormat() ); break; } - } catch (Exception $e) { + } catch (Exception) { } } $format = self::$_format; @@ -75,7 +75,7 @@ public function render(Varien_Object $row) $data = ($this->getColumn()->getGmtoffset()) ? Mage::app()->getLocale()->date($data, $dateFormat)->toString($format) : Mage::getSingleton('core/locale')->date($data, $dateFormat, null, false)->toString($format); - } catch (Exception $e) { + } catch (Exception) { $data = ($this->getColumn()->getTimezone()) ? Mage::app()->getLocale()->date($data, $dateFormat)->toString($format) : Mage::getSingleton('core/locale')->date($data, $dateFormat, null, false)->toString($format); diff --git a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Default.php b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Default.php index 3add6de481c..4936c1d7ab2 100644 --- a/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Default.php +++ b/app/code/core/Mage/Adminhtml/Block/Sales/Items/Column/Default.php @@ -54,7 +54,7 @@ public function getCustomizedOptionValue($optionInfo) try { $group = Mage::getModel('catalog/product_option')->groupFactory($optionInfo['option_type']); return $group->getCustomizedView($optionInfo); - } catch (Exception $e) { + } catch (Exception) { return $default; } } diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php index 99a44c3d681..183d3ac05ad 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Date.php @@ -192,7 +192,7 @@ protected function _convertDate($date, $locale) $dateObj->setTimezone(Mage_Core_Model_Locale::DEFAULT_TIMEZONE); return $dateObj; - } catch (Exception $e) { + } catch (Exception) { return null; } } diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Datetime.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Datetime.php index 3eb9c9cbdff..ea7ae08dee5 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Datetime.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Filter/Datetime.php @@ -72,7 +72,7 @@ protected function _convertDate($date, $locale) $dateObj->setTimezone(Mage_Core_Model_Locale::DEFAULT_TIMEZONE); return $dateObj; - } catch (Exception $e) { + } catch (Exception) { return null; } } diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Date.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Date.php index 218f530d9e7..0a6dd634054 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Date.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Date.php @@ -60,7 +60,7 @@ public function render(Varien_Object $row) $data = Mage::getSingleton('core/locale') ->date($data, Zend_Date::ISO_8601, null, false)->toString($format); } - } catch (Exception $e) { + } catch (Exception) { if ($this->getColumn()->getTimezone()) { $data = Mage::app()->getLocale() ->date($data, Varien_Date::DATETIME_INTERNAL_FORMAT)->toString($format); diff --git a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php index 71797a662bf..dbdb456aa42 100644 --- a/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php +++ b/app/code/core/Mage/Adminhtml/Block/Widget/Grid/Column/Renderer/Datetime.php @@ -57,7 +57,7 @@ public function render(Varien_Object $row) $data = Mage::app()->getLocale() ->date($data, Varien_Date::DATETIME_INTERNAL_FORMAT, $locale, $useTimezone) ->toString($format); - } catch (Exception $e) { + } catch (Exception) { $data = Mage::app()->getLocale() ->date($data, Varien_Date::DATETIME_INTERNAL_FORMAT)->toString($format); } diff --git a/app/code/core/Mage/Adminhtml/Model/Config/Data.php b/app/code/core/Mage/Adminhtml/Model/Config/Data.php index edc85b37bda..734eb44af09 100644 --- a/app/code/core/Mage/Adminhtml/Model/Config/Data.php +++ b/app/code/core/Mage/Adminhtml/Model/Config/Data.php @@ -258,7 +258,7 @@ protected function _isSectionAllowed($section) $session->getData('acl')->get($resourceLookup)->getResourceId(), ); } - } catch (Exception $e) { + } catch (Exception) { return false; } return false; diff --git a/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php b/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php index 2d5f239cf50..dffa7a903fc 100644 --- a/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php +++ b/app/code/core/Mage/Adminhtml/Model/Sales/Order/Create.php @@ -900,7 +900,7 @@ protected function _parseOptions(Mage_Sales_Model_Quote_Item $item, $additionalO ); } [$label, $value] = explode(':', $additionalOption, 2); - } catch (Exception $e) { + } catch (Exception) { Mage::throwException(Mage::helper('adminhtml')->__('There is an error in one of the option rows.')); } $label = trim($label); diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php index fa491f6f7fd..6d3cdb93c1b 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Currency/Cron.php @@ -40,7 +40,7 @@ protected function _afterSave() ->setValue($cronExprString) ->setPath(self::CRON_STRING_PATH) ->save(); - } catch (Exception $e) { + } catch (Exception) { throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.')); } return $this; diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Log/Cron.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Log/Cron.php index 67bb168447f..b59c491be72 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Log/Cron.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Log/Cron.php @@ -56,7 +56,7 @@ protected function _afterSave() ->setValue((string) Mage::getConfig()->getNode(self::CRON_MODEL_PATH)) ->setPath(self::CRON_MODEL_PATH) ->save(); - } catch (Exception $e) { + } catch (Exception) { Mage::throwException(Mage::helper('adminhtml')->__('Unable to save the cron expression.')); } return $this; diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Product/Alert/Cron.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Product/Alert/Cron.php index f58491a0036..37c81641f95 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Product/Alert/Cron.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Product/Alert/Cron.php @@ -46,7 +46,7 @@ protected function _afterSave() ->setValue((string) Mage::getConfig()->getNode(self::CRON_MODEL_PATH)) ->setPath(self::CRON_MODEL_PATH) ->save(); - } catch (Exception $e) { + } catch (Exception) { throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.')); } return $this; diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized/Array.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized/Array.php index 5149f4d89a2..6041a23c457 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized/Array.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Serialized/Array.php @@ -24,7 +24,7 @@ protected function _beforeSave() { try { Mage::helper('core/unserializeArray')->unserialize(serialize($this->getValue())); - } catch (Exception $e) { + } catch (Exception) { Mage::throwException(Mage::helper('adminhtml')->__('Serialized data is incorrect')); } diff --git a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap/Cron.php b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap/Cron.php index cd770ba8eee..e7cdc485600 100644 --- a/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap/Cron.php +++ b/app/code/core/Mage/Adminhtml/Model/System/Config/Backend/Sitemap/Cron.php @@ -46,7 +46,7 @@ protected function _afterSave() ->setValue((string) Mage::getConfig()->getNode(self::CRON_MODEL_PATH)) ->setPath(self::CRON_MODEL_PATH) ->save(); - } catch (Exception $e) { + } catch (Exception) { throw new Exception(Mage::helper('cron')->__('Unable to save the cron expression.')); } return $this; diff --git a/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php b/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php index f0c8b04b344..6ec6dc0f64f 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Api/RoleController.php @@ -120,7 +120,7 @@ public function deleteAction() try { Mage::getModel('api/roles')->load($rid)->delete(); Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The role has been deleted.')); - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while deleting this role.')); } @@ -186,7 +186,7 @@ public function saveRoleAction() $rid = $role->getId(); Mage::getSingleton('adminhtml/session')->addSuccess($this->__('The role has been saved.')); - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('adminhtml/session')->addError($this->__('An error occurred while saving this role.')); } diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php index 3c33e2ddaf1..615bca16c07 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/CategoryController.php @@ -395,7 +395,7 @@ public function deleteAction() Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); $this->getResponse()->setRedirect($this->getUrl('*/*/edit', ['_current' => true])); return; - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('An error occurred while trying to delete the category.')); $this->getResponse()->setRedirect($this->getUrl('*/*/edit', ['_current' => true])); return; diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GroupController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GroupController.php index 3614bd7e6e3..9599b95aec1 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GroupController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/GroupController.php @@ -31,7 +31,7 @@ public function saveAction() } else { try { $model->save(); - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('catalog')->__('An error occurred while saving this group.')); } } diff --git a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/SetController.php b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/SetController.php index 4ec672622a5..3b8007272d1 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/SetController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Catalog/Product/SetController.php @@ -193,7 +193,7 @@ public function deleteAction() $this->_getSession()->addSuccess($this->__('The attribute set has been removed.')); $this->getResponse()->setRedirect($this->getUrl('*/*/')); - } catch (Exception $e) { + } catch (Exception) { $this->_getSession()->addError($this->__('An error occurred while deleting this set.')); $this->_redirectReferer(); } diff --git a/app/code/core/Mage/Adminhtml/controllers/Checkout/AgreementController.php b/app/code/core/Mage/Adminhtml/controllers/Checkout/AgreementController.php index 3bd68f1d2e1..068e2861be3 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Checkout/AgreementController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Checkout/AgreementController.php @@ -94,7 +94,7 @@ public function saveAction() return; } catch (Mage_Core_Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('checkout')->__('An error occurred while saving this condition.')); } @@ -123,7 +123,7 @@ public function deleteAction() return; } catch (Mage_Core_Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('checkout')->__('An error occurred while deleting this condition.')); } diff --git a/app/code/core/Mage/Adminhtml/controllers/Cms/Wysiwyg/ImagesController.php b/app/code/core/Mage/Adminhtml/controllers/Cms/Wysiwyg/ImagesController.php index acd440cb025..759dc7ad0fd 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Cms/Wysiwyg/ImagesController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Cms/Wysiwyg/ImagesController.php @@ -56,7 +56,7 @@ public function treeJsonAction() $this->getLayout()->createBlock('adminhtml/cms_wysiwyg_images_tree') ->getTreeJson(), ); - } catch (Exception $e) { + } catch (Exception) { $this->getResponse()->setBody(Mage::helper('core')->jsonEncode([])); } } diff --git a/app/code/core/Mage/Adminhtml/controllers/Cms/WysiwygController.php b/app/code/core/Mage/Adminhtml/controllers/Cms/WysiwygController.php index 3ee59ec2b3d..1099253c1fc 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Cms/WysiwygController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Cms/WysiwygController.php @@ -37,7 +37,7 @@ public function directiveAction() } $image = Varien_Image_Adapter::factory('GD2'); $image->open($url); - } catch (Exception $e) { + } catch (Exception) { $image = Varien_Image_Adapter::factory('GD2'); $image->open(Mage::getSingleton('cms/wysiwyg_config')->getSkinImagePlaceholderPath()); } diff --git a/app/code/core/Mage/Adminhtml/controllers/IndexController.php b/app/code/core/Mage/Adminhtml/controllers/IndexController.php index c79fdf3a9ed..90ef5924f94 100644 --- a/app/code/core/Mage/Adminhtml/controllers/IndexController.php +++ b/app/code/core/Mage/Adminhtml/controllers/IndexController.php @@ -271,7 +271,7 @@ public function resetPasswordAction() 'minAdminPasswordLength' => $this->_getModel('admin/user')->getMinAdminPasswordLength(), ]; $this->_outTemplate('resetforgottenpassword', $data); - } catch (Exception $exception) { + } catch (Exception) { $this->_getSession()->addError(Mage::helper('adminhtml')->__('Your password reset link has expired.')); $this->_redirect('*/*/forgotpassword', ['_nosecret' => true]); } diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php index e1a4489babf..d58180a4674 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/CreditmemoController.php @@ -235,7 +235,7 @@ public function updateQtyAction() 'message' => $e->getMessage(), ]; $response = Mage::helper('core')->jsonEncode($response); - } catch (Exception $e) { + } catch (Exception) { $response = [ 'error' => true, 'message' => $this->__('Cannot update the item\'s quantity.'), @@ -323,7 +323,7 @@ public function cancelAction() $this->_getSession()->addSuccess($this->__('The credit memo has been canceled.')); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { $this->_getSession()->addError($this->__('Unable to cancel the credit memo.')); } $this->_redirect('*/*/view', ['creditmemo_id' => $creditmemo->getId()]); @@ -345,7 +345,7 @@ public function voidAction() $this->_getSession()->addSuccess($this->__('The credit memo has been voided.')); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { $this->_getSession()->addError($this->__('Unable to void the credit memo.')); } $this->_redirect('*/*/view', ['creditmemo_id' => $creditmemo->getId()]); @@ -385,7 +385,7 @@ public function addCommentAction() 'message' => $e->getMessage(), ]; $response = Mage::helper('core')->jsonEncode($response); - } catch (Exception $e) { + } catch (Exception) { $response = [ 'error' => true, 'message' => $this->__('Cannot add new comment.'), diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php index 368c68d2e99..3b8f73ba350 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/InvoiceController.php @@ -190,7 +190,7 @@ public function updateQtyAction() 'message' => $e->getMessage(), ]; $response = Mage::helper('core')->jsonEncode($response); - } catch (Exception $e) { + } catch (Exception) { $response = [ 'error' => true, 'message' => $this->__('Cannot update item quantity.'), @@ -304,7 +304,7 @@ public function captureAction() $this->_getSession()->addSuccess($this->__('The invoice has been captured.')); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { $this->_getSession()->addError($this->__('Invoice capturing error.')); } $this->_redirect('*/*/view', ['invoice_id' => $invoice->getId()]); @@ -325,7 +325,7 @@ public function cancelAction() $this->_getSession()->addSuccess($this->__('The invoice has been canceled.')); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { $this->_getSession()->addError($this->__('Invoice canceling error.')); } $this->_redirect('*/*/view', ['invoice_id' => $invoice->getId()]); @@ -346,7 +346,7 @@ public function voidAction() $this->_getSession()->addSuccess($this->__('The invoice has been voided.')); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { $this->_getSession()->addError($this->__('Invoice voiding error.')); } $this->_redirect('*/*/view', ['invoice_id' => $invoice->getId()]); @@ -380,7 +380,7 @@ public function addCommentAction() 'message' => $e->getMessage(), ]; $response = Mage::helper('core')->jsonEncode($response); - } catch (Exception $e) { + } catch (Exception) { $response = [ 'error' => true, 'message' => $this->__('Cannot add new comment.'), diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php index 5dbc3f7ab58..7ebdd108306 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/ShipmentController.php @@ -260,7 +260,7 @@ public function emailAction() } } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { $this->_getSession()->addError($this->__('Cannot send shipment information.')); } $this->_redirect('*/*/view', [ @@ -305,7 +305,7 @@ public function addTrackAction() 'error' => true, 'message' => $e->getMessage(), ]; - } catch (Exception $e) { + } catch (Exception) { $response = [ 'error' => true, 'message' => $this->__('Cannot add tracking number.'), @@ -338,7 +338,7 @@ public function removeTrackAction() 'message' => $this->__('Cannot initialize shipment for delete tracking number.'), ]; } - } catch (Exception $e) { + } catch (Exception) { $response = [ 'error' => true, 'message' => $this->__('Cannot delete tracking number.'), @@ -367,7 +367,7 @@ public function viewTrackAction() if ($track->getId()) { try { $response = $track->getNumberDetail(); - } catch (Exception $e) { + } catch (Exception) { $response = [ 'error' => true, 'message' => $this->__('Cannot retrieve tracking number detail.'), @@ -430,7 +430,7 @@ public function addCommentAction() 'message' => $e->getMessage(), ]; $response = Mage::helper('core')->jsonEncode($response); - } catch (Exception $e) { + } catch (Exception) { $response = [ 'error' => true, 'message' => $this->__('Cannot add new comment.'), diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/View/GiftmessageController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/View/GiftmessageController.php index ae5a6f49a72..0cb6f03740f 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/Order/View/GiftmessageController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/Order/View/GiftmessageController.php @@ -36,7 +36,7 @@ public function saveAction() ->saveAllInOrder(); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { $this->_getSession()->addError(Mage::helper('giftmessage')->__('An error occurred while saving the gift message.')); } diff --git a/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php b/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php index d39b48f90a1..d5074e128d6 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php @@ -171,7 +171,7 @@ public function holdAction() ); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { $this->_getSession()->addError($this->__('The order was not put on hold.')); } $this->_redirect('*/sales_order/view', ['order_id' => $order->getId()]); @@ -192,7 +192,7 @@ public function unholdAction() ); } catch (Mage_Core_Exception $e) { $this->_getSession()->addError($e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { $this->_getSession()->addError($this->__('The order was not unheld.')); } $this->_redirect('*/sales_order/view', ['order_id' => $order->getId()]); @@ -267,7 +267,7 @@ public function addCommentAction() 'error' => true, 'message' => $e->getMessage(), ]; - } catch (Exception $e) { + } catch (Exception) { $response = [ 'error' => true, 'message' => $this->__('Cannot add order history.'), diff --git a/app/code/core/Mage/Adminhtml/controllers/System/AccountController.php b/app/code/core/Mage/Adminhtml/controllers/System/AccountController.php index bac19ff681c..9ac05c2de1c 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/AccountController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/AccountController.php @@ -76,7 +76,7 @@ public function saveAction() Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('The account has been saved.')); } catch (Mage_Core_Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('An error occurred while saving account.')); } $this->getResponse()->setRedirect($this->getUrl('*/*/')); diff --git a/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php b/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php index 9cfbffc231b..7a755254d3b 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/ConfigController.php @@ -278,11 +278,11 @@ protected function _isSectionAllowed($section) } return true; } - } catch (Zend_Acl_Exception $e) { + } catch (Zend_Acl_Exception) { $this->norouteAction(); $this->setFlag('', self::FLAG_NO_DISPATCH, true); return false; - } catch (Exception $e) { + } catch (Exception) { $this->deniedAction(); $this->setFlag('', self::FLAG_NO_DISPATCH, true); return false; diff --git a/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php b/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php index 700845f186a..ff479258e27 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/Convert/ProfileController.php @@ -285,7 +285,7 @@ public function batchFinishAction() $batchModel->beforeFinish(); } catch (Mage_Core_Exception $e) { $result['error'] = $e->getMessage(); - } catch (Exception $e) { + } catch (Exception) { $result['error'] = Mage::helper('adminhtml')->__('An error occurred while finishing process. Please refresh the cache'); } $batchModel->delete(); diff --git a/app/code/core/Mage/Adminhtml/controllers/Tax/ClassController.php b/app/code/core/Mage/Adminhtml/controllers/Tax/ClassController.php index e83ad26c31b..3ad60b9f45b 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Tax/ClassController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Tax/ClassController.php @@ -38,7 +38,7 @@ public function saveAction() Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); Mage::getSingleton('adminhtml/session')->setClassData($postData); $this->_redirectReferer(); - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('adminhtml/session')->addError( Mage::helper('tax')->__('An error occurred while saving this tax class.'), ); diff --git a/app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php b/app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php index 79580aadcc5..6344df0febc 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Tax/RateController.php @@ -166,7 +166,7 @@ public function deleteAction() return true; } catch (Mage_Core_Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('An error occurred while deleting this rate.')); } if ($referer = $this->getRequest()->getServer('HTTP_REFERER')) { @@ -251,7 +251,7 @@ public function importPostAction() Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('tax')->__('The tax rate has been imported.')); } catch (Mage_Core_Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('adminhtml/session')->addError(Mage::helper('tax')->__('Invalid file upload attempt')); } } else { diff --git a/app/code/core/Mage/Adminhtml/controllers/Tax/RuleController.php b/app/code/core/Mage/Adminhtml/controllers/Tax/RuleController.php index fe87f71f76f..d2ac16729fe 100644 --- a/app/code/core/Mage/Adminhtml/controllers/Tax/RuleController.php +++ b/app/code/core/Mage/Adminhtml/controllers/Tax/RuleController.php @@ -120,7 +120,7 @@ public function saveAction() return $this->_redirect('*/*/'); } catch (Mage_Core_Exception $e) { $session->addError($e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { $session->addError($this->_getHelperModel('tax')->__('An error occurred while saving this tax rule.')); } @@ -183,7 +183,7 @@ public function deleteAction() return; } catch (Mage_Core_Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('adminhtml/session') ->addError(Mage::helper('tax')->__('An error occurred while deleting this tax rule.')); } diff --git a/app/code/core/Mage/Api/Model/Acl/Role/Registry.php b/app/code/core/Mage/Api/Model/Acl/Role/Registry.php index bad6f49e0d1..5247cd60616 100644 --- a/app/code/core/Mage/Api/Model/Acl/Role/Registry.php +++ b/app/code/core/Mage/Api/Model/Acl/Role/Registry.php @@ -30,7 +30,7 @@ public function addParent($role, $parents) $roleId = $role; $role = $this->get($role); } - } catch (Zend_Acl_Role_Registry_Exception $e) { + } catch (Zend_Acl_Role_Registry_Exception) { throw new Zend_Acl_Role_Registry_Exception("Child Role id '$roleId' does not exist"); } @@ -45,7 +45,7 @@ public function addParent($role, $parents) $roleParentId = $parent; } $roleParent = $this->get($roleParentId); - } catch (Zend_Acl_Role_Registry_Exception $e) { + } catch (Zend_Acl_Role_Registry_Exception) { throw new Zend_Acl_Role_Registry_Exception("Parent Role id '$roleParentId' does not exist"); } $this->_roles[$roleId]['parents'][$roleParentId] = $roleParent; diff --git a/app/code/core/Mage/Api/Model/Resource/Rules.php b/app/code/core/Mage/Api/Model/Resource/Rules.php index 34dce77a6a4..720ea30c037 100644 --- a/app/code/core/Mage/Api/Model/Resource/Rules.php +++ b/app/code/core/Mage/Api/Model/Resource/Rules.php @@ -56,7 +56,7 @@ public function saveRel(Mage_Api_Model_Rules $rule) } catch (Mage_Core_Exception $e) { $adapter->rollBack(); throw $e; - } catch (Exception $e) { + } catch (Exception) { $adapter->rollBack(); } } diff --git a/app/code/core/Mage/Api/Model/Resource/User.php b/app/code/core/Mage/Api/Model/Resource/User.php index f0a08a2152d..4685a149036 100644 --- a/app/code/core/Mage/Api/Model/Resource/User.php +++ b/app/code/core/Mage/Api/Model/Resource/User.php @@ -277,7 +277,7 @@ public function _saveRelations(Mage_Core_Model_Abstract $user) } catch (Mage_Core_Exception $e) { $adapter->rollBack(); throw $e; - } catch (Exception $e) { + } catch (Exception) { $adapter->rollBack(); } return $this; diff --git a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php index 818787607cd..d622906c0a0 100644 --- a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php +++ b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php @@ -212,7 +212,7 @@ public function login($username, $apiKey = null) try { $this->_startSession(); $this->_getSession()->login($username, $apiKey); - } catch (Exception $e) { + } catch (Exception) { $this->_fault('access_denied'); return; } diff --git a/app/code/core/Mage/Api/Model/Session.php b/app/code/core/Mage/Api/Model/Session.php index c26074e9f02..ada42dd3cb0 100644 --- a/app/code/core/Mage/Api/Model/Session.php +++ b/app/code/core/Mage/Api/Model/Session.php @@ -82,7 +82,7 @@ public function clear() if ($sessId = $this->getSessionId()) { try { Mage::getModel('api/user')->logoutBySessId($sessId); - } catch (Exception $e) { + } catch (Exception) { return false; } } @@ -192,7 +192,7 @@ public function isAllowed($resource, $privilege = null) try { return $acl->isAllowed($user->getAclRole(), $resource, $privilege); - } catch (Exception $e) { + } catch (Exception) { return false; } } diff --git a/app/code/core/Mage/Api2/Model/Dispatcher.php b/app/code/core/Mage/Api2/Model/Dispatcher.php index 65a70f93f46..a7c05f72645 100644 --- a/app/code/core/Mage/Api2/Model/Dispatcher.php +++ b/app/code/core/Mage/Api2/Model/Dispatcher.php @@ -76,7 +76,7 @@ public static function loadResourceModel($model, $apiType, $userType, $version) try { /** @var Mage_Api2_Model_Resource $modelObj */ $modelObj = Mage::getModel($class); - } catch (Exception $e) { + } catch (Exception) { // getModel() throws exception when in application is in development mode - skip it to next check } if (empty($modelObj) || !$modelObj instanceof Mage_Api2_Model_Resource) { diff --git a/app/code/core/Mage/Api2/Model/Request/Interpreter/Json.php b/app/code/core/Mage/Api2/Model/Request/Interpreter/Json.php index 4dd49f35e91..a5cec63acab 100644 --- a/app/code/core/Mage/Api2/Model/Request/Interpreter/Json.php +++ b/app/code/core/Mage/Api2/Model/Request/Interpreter/Json.php @@ -29,7 +29,7 @@ public function interpret($body) try { $decoded = Zend_Json::decode($body); - } catch (Zend_Json_Exception $e) { + } catch (Zend_Json_Exception) { throw new Mage_Api2_Exception('Decoding error.', Mage_Api2_Model_Server::HTTP_BAD_REQUEST); } diff --git a/app/code/core/Mage/Api2/Model/Resource.php b/app/code/core/Mage/Api2/Model/Resource.php index 9a0047f62fd..88d404e6e0d 100644 --- a/app/code/core/Mage/Api2/Model/Resource.php +++ b/app/code/core/Mage/Api2/Model/Resource.php @@ -756,7 +756,7 @@ protected function _applyFilter(Varien_Data_Collection_Db $collection) try { $collection->$methodName($attributeCode, $filterEntry); - } catch (Exception $e) { + } catch (Exception) { $this->_critical(self::RESOURCE_COLLECTION_FILTERING_ERROR); } } @@ -824,7 +824,7 @@ protected function _isSubCallAllowed($resourceId) try { return $globalAcl->isAllowed($this->getApiUser(), $resourceId, $this->getOperation()); - } catch (Mage_Api2_Exception $e) { + } catch (Mage_Api2_Exception) { throw new Exception('Invalid arguments for isAllowed() call'); } } @@ -1041,7 +1041,7 @@ protected function _getStore() } $store = Mage::app()->getStore($store); } - } catch (Mage_Core_Model_Store_Exception $e) { + } catch (Mage_Core_Model_Store_Exception) { // store does not exist $this->_critical('Requested store is invalid', Mage_Api2_Model_Server::HTTP_BAD_REQUEST); } diff --git a/app/code/core/Mage/Catalog/Helper/Product/Configuration.php b/app/code/core/Mage/Catalog/Helper/Product/Configuration.php index 6b66cc845b9..0d26e48a842 100644 --- a/app/code/core/Mage/Catalog/Helper/Product/Configuration.php +++ b/app/code/core/Mage/Catalog/Helper/Product/Configuration.php @@ -204,7 +204,7 @@ public function getFormattedOptionValue($optionValue, $params = null) try { $group = Mage::getModel('catalog/product_option')->groupFactory($optionInfo['option_type']); return ['value' => $group->getCustomizedView($optionInfo)]; - } catch (Exception $e) { + } catch (Exception) { return $_default; } } diff --git a/app/code/core/Mage/Catalog/Helper/Product/Options.php b/app/code/core/Mage/Catalog/Helper/Product/Options.php index 8155e18a8f7..3afcfd7fc4d 100644 --- a/app/code/core/Mage/Catalog/Helper/Product/Options.php +++ b/app/code/core/Mage/Catalog/Helper/Product/Options.php @@ -42,7 +42,7 @@ public function downloadFileOption($response, $filePath, $info) $response->sendHeaders(); readfile($filePath); - } catch (Exception $e) { + } catch (Exception) { return false; } return true; diff --git a/app/code/core/Mage/Catalog/Model/Api/Resource.php b/app/code/core/Mage/Catalog/Model/Api/Resource.php index 5ddda5b6db0..897a5e80b02 100644 --- a/app/code/core/Mage/Catalog/Model/Api/Resource.php +++ b/app/code/core/Mage/Catalog/Model/Api/Resource.php @@ -82,7 +82,7 @@ protected function _getStoreId($store = null) try { $storeId = Mage::app()->getStore($store)->getId(); - } catch (Mage_Core_Model_Store_Exception $e) { + } catch (Mage_Core_Model_Store_Exception) { $this->_fault('store_not_exists'); } @@ -117,7 +117,7 @@ public function currentStore($store = null) if (!is_null($store)) { try { $storeId = Mage::app()->getStore($store)->getId(); - } catch (Mage_Core_Model_Store_Exception $e) { + } catch (Mage_Core_Model_Store_Exception) { $this->_fault('store_not_exists'); } diff --git a/app/code/core/Mage/Catalog/Model/Api2/Product/Validator/Product.php b/app/code/core/Mage/Catalog/Model/Api2/Product/Validator/Product.php index 80316912e1a..8f9a73a0fc6 100644 --- a/app/code/core/Mage/Catalog/Model/Api2/Product/Validator/Product.php +++ b/app/code/core/Mage/Catalog/Model/Api2/Product/Validator/Product.php @@ -187,7 +187,7 @@ protected function _validateAttributes($data, $productEntity) if ($attribute->getBackendType() == 'datetime') { try { $attribute->getBackend()->formatDate($value); - } catch (Zend_Date_Exception $e) { + } catch (Zend_Date_Exception) { $this->_addError(sprintf('Invalid date in the "%s" field.', $attributeCode)); } } diff --git a/app/code/core/Mage/Catalog/Model/Api2/Product/Website/Rest.php b/app/code/core/Mage/Catalog/Model/Api2/Product/Website/Rest.php index 01f3bc25d3d..a86c2331a68 100644 --- a/app/code/core/Mage/Catalog/Model/Api2/Product/Website/Rest.php +++ b/app/code/core/Mage/Catalog/Model/Api2/Product/Website/Rest.php @@ -150,7 +150,7 @@ protected function _multiCreate(array $data) ], ); } - } catch (Exception $e) { + } catch (Exception) { $this->_errorMessage( Mage_Api2_Model_Resource::RESOURCE_INTERNAL_ERROR, Mage_Api2_Model_Server::HTTP_INTERNAL_ERROR, diff --git a/app/code/core/Mage/Catalog/Model/Category/Api.php b/app/code/core/Mage/Catalog/Model/Category/Api.php index e90af60959f..a7fc37d18c6 100644 --- a/app/code/core/Mage/Catalog/Model/Category/Api.php +++ b/app/code/core/Mage/Catalog/Model/Category/Api.php @@ -60,7 +60,7 @@ public function level($website = null, $store = null, $categoryId = null) $store = Mage::app()->getStore($store); $storeId = $store->getId(); $ids = $store->getRootCategoryId(); - } catch (Mage_Core_Model_Store_Exception $e) { + } catch (Mage_Core_Model_Store_Exception) { $this->_fault('store_not_exists'); } } else { // load children of specified category id diff --git a/app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php b/app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php index 644cf3f89e0..761aa53a779 100644 --- a/app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php +++ b/app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php @@ -732,7 +732,7 @@ public function saveRow(array $importData) if (!in_array($website->getId(), $websiteIds)) { $websiteIds[] = $website->getId(); } - } catch (Exception $e) { + } catch (Exception) { } } $product->setWebsiteIds($websiteIds); @@ -872,7 +872,7 @@ public function saveRowSilently(array $importData) { try { return $this->saveRow($importData); - } catch (Exception $e) { + } catch (Exception) { return false; } } diff --git a/app/code/core/Mage/Catalog/Model/Design.php b/app/code/core/Mage/Catalog/Model/Design.php index 73bfac29048..870fb620a26 100644 --- a/app/code/core/Mage/Catalog/Model/Design.php +++ b/app/code/core/Mage/Catalog/Model/Design.php @@ -367,7 +367,7 @@ protected function _extractSettings($object) if (!Mage::getModel('core/layout_validator')->isValid($customLayout)) { $customLayout = ''; } - } catch (Exception $e) { + } catch (Exception) { $customLayout = ''; } } diff --git a/app/code/core/Mage/Catalog/Model/Product/Api.php b/app/code/core/Mage/Catalog/Model/Product/Api.php index 62509d50d71..00fa006dd75 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Api.php +++ b/app/code/core/Mage/Catalog/Model/Product/Api.php @@ -293,7 +293,7 @@ protected function _prepareDataForSave($product, $productData) if (is_string($website)) { try { $website = Mage::app()->getWebsite($website)->getId(); - } catch (Exception $e) { + } catch (Exception) { } } } diff --git a/app/code/core/Mage/Catalog/Model/Product/Api/V2.php b/app/code/core/Mage/Catalog/Model/Product/Api/V2.php index 9a1be0575ab..6dbc28aba3b 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Api/V2.php +++ b/app/code/core/Mage/Catalog/Model/Product/Api/V2.php @@ -278,7 +278,7 @@ protected function _prepareDataForSave($product, $productData) if (is_string($website)) { try { $website = Mage::app()->getWebsite($website)->getId(); - } catch (Exception $e) { + } catch (Exception) { } } } diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php index 42e7536eb0e..28ea833fb55 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php @@ -578,7 +578,7 @@ protected function _moveImageFromTmp($file) $destDirectory = dirname($this->_getConfig()->getMediaPath($file)); try { $ioObject->open(['path' => $destDirectory]); - } catch (Exception $e) { + } catch (Exception) { $ioObject->mkdir($destDirectory, 0777, true); $ioObject->open(['path' => $destDirectory]); } @@ -666,7 +666,7 @@ protected function _copyImage($file) $this->_getConfig()->getMediaPath($destFile), ); } - } catch (Exception $e) { + } catch (Exception) { $file = $this->_getConfig()->getMediaPath($file); $io = new Varien_Io_File(); Mage::throwException( diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api.php index 75d155a5e6c..1ea63661feb 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Media/Api.php @@ -174,7 +174,7 @@ public function create($productId, $data, $store = null, $identifierType = null) $product->save(); } catch (Mage_Core_Exception $e) { $this->_fault('not_created', $e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { $this->_fault('not_created', Mage::helper('catalog')->__('Cannot create image.')); } @@ -223,7 +223,7 @@ public function update($productId, $file, $data, $store = null, $identifierType $fileName = Mage::getBaseDir('media') . DS . 'catalog' . DS . 'product' . $file; $ioAdapter->open(['path' => dirname($fileName)]); $ioAdapter->write(basename($fileName), $fileContent, 0666); - } catch (Exception $e) { + } catch (Exception) { $this->_fault('not_created', Mage::helper('catalog')->__('Can\'t create image.')); } } diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api.php index 97e6dc149cf..3270641a028 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api.php @@ -123,7 +123,7 @@ public function prepareTierPrices($product, $tierPrices = null) } else { try { $tierPrice['website'] = Mage::app()->getWebsite($tierPrice['website'])->getId(); - } catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception) { $tierPrice['website'] = 0; } } diff --git a/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php b/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php index 319e348dc0a..76dc1af77f9 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php +++ b/app/code/core/Mage/Catalog/Model/Product/Attribute/Tierprice/Api/V2.php @@ -42,7 +42,7 @@ public function prepareTierPrices($product, $tierPrices = null) } else { try { $tierPrice->website = Mage::app()->getWebsite($tierPrice->website)->getId(); - } catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception) { $tierPrice->website = 0; } } diff --git a/app/code/core/Mage/Catalog/Model/Product/Link/Api.php b/app/code/core/Mage/Catalog/Model/Product/Link/Api.php index 1e58e42d851..c1adec7724b 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Link/Api.php +++ b/app/code/core/Mage/Catalog/Model/Product/Link/Api.php @@ -120,7 +120,7 @@ public function assign($type, $productId, $linkedProductId, $data = [], $identif $indexerPrice = Mage::getResourceModel('catalog/product_indexer_price'); $indexerPrice->reindexProductIds($productId); - } catch (Exception $e) { + } catch (Exception) { $this->_fault('data_invalid', Mage::helper('catalog')->__('Link product does not exist.')); } @@ -176,7 +176,7 @@ public function update($type, $productId, $linkedProductId, $data = [], $identif $indexerPrice = Mage::getResourceModel('catalog/product_indexer_price'); $indexerPrice->reindexProductIds($productId); - } catch (Exception $e) { + } catch (Exception) { $this->_fault('data_invalid', Mage::helper('catalog')->__('Link product does not exist.')); } @@ -216,7 +216,7 @@ public function remove($type, $productId, $linkedProductId, $identifierType = nu try { $link->getResource()->saveProductLinks($product, $links, $typeId); - } catch (Exception $e) { + } catch (Exception) { $this->_fault('not_removed'); } diff --git a/app/code/core/Mage/Catalog/Model/Product/Link/Api/V2.php b/app/code/core/Mage/Catalog/Model/Product/Link/Api/V2.php index ea163a82fb0..02874325eda 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Link/Api/V2.php +++ b/app/code/core/Mage/Catalog/Model/Product/Link/Api/V2.php @@ -122,7 +122,7 @@ public function update($type, $productId, $linkedProductId, $data = [], $identif $indexerPrice = Mage::getResourceModel('catalog/product_indexer_price'); $indexerPrice->reindexProductIds($productId); - } catch (Exception $e) { + } catch (Exception) { $this->_fault('data_invalid', Mage::helper('catalog')->__('Link product does not exist.')); } diff --git a/app/code/core/Mage/Catalog/Model/Product/Option/Api.php b/app/code/core/Mage/Catalog/Model/Product/Option/Api.php index 95260524ff2..28bc2f05426 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option/Api.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option/Api.php @@ -280,7 +280,7 @@ public function remove($optionId) $option->deletePrices($optionId); $option->deleteTitles($optionId); $option->delete(); - } catch (Exception $e) { + } catch (Exception) { $this->_fault('delete_option_error'); } return true; diff --git a/app/code/core/Mage/Catalog/Model/Product/Option/Observer.php b/app/code/core/Mage/Catalog/Model/Product/Option/Observer.php index 1dc0bff0c72..331e1c5706f 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option/Observer.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option/Observer.php @@ -35,7 +35,7 @@ public function copyQuoteFilesToOrderFiles($observer) $group = $option->groupFactory($option->getType()) ->setQuoteItemOption($itemOption) ->copyQuoteToOrder(); - } catch (Exception $e) { + } catch (Exception) { continue; } } diff --git a/app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php b/app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php index 15339af8eb2..ff458c232fb 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option/Type/Date.php @@ -221,7 +221,7 @@ public function prepareOptionValueForRequest($optionValue) } else { return ['date_internal' => $optionValue]; } - } catch (Exception $e) { + } catch (Exception) { return ['date_internal' => $optionValue]; } } diff --git a/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php b/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php index 4cc2864166f..1393b22ce40 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/core/Mage/Catalog/Model/Product/Option/Type/File.php @@ -44,7 +44,7 @@ public function getCustomizedView($optionInfo) } elseif (isset($optionInfo['value'])) { return $optionInfo['value']; } - } catch (Exception $e) { + } catch (Exception) { return $optionInfo['value']; } return ''; @@ -168,7 +168,7 @@ protected function _validateUploadedFile() $fileInfo = $upload->getFileInfo($file); $fileInfo = $fileInfo[$file]; $fileInfo['title'] = $fileInfo['name']; - } catch (Exception $e) { + } catch (Exception) { // when file exceeds the upload_max_filesize, $_FILES is empty if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] > $this->_getUploadMaxFilesize()) { $this->setIsValid(false); @@ -427,7 +427,7 @@ public function prepareForCart() $result = serialize($value); try { Mage::helper('core/unserializeArray')->unserialize($result); - } catch (Exception $e) { + } catch (Exception) { Mage::throwException(Mage::helper('catalog')->__('File options format is not valid.')); } } else { @@ -472,7 +472,7 @@ public function getFormattedOptionValue($optionValue) $this->_formattedOptionValue = $this->_getOptionHtml($value); $this->getConfigurationItemOption()->setValue(serialize($value)); return $this->_formattedOptionValue; - } catch (Exception $e) { + } catch (Exception) { return $optionValue; } } @@ -508,7 +508,7 @@ protected function _getOptionHtml($optionValue) Mage::helper('core')->escapeHtml($title), $sizes, ); - } catch (Exception $e) { + } catch (Exception) { Mage::throwException(Mage::helper('catalog')->__('File options format is not valid.')); } } @@ -558,7 +558,7 @@ public function getEditableOptionValue($optionValue) Mage::helper('core')->escapeHtml($value['title']), $this->getConfigurationItemOption()->getId(), ); - } catch (Exception $e) { + } catch (Exception) { return $optionValue; } } @@ -578,7 +578,7 @@ public function parseOptionValue($optionValue, $productOptionValues) $option = Mage::getModel('sales/quote_item_option')->load($confItemOptionId); try { return $option->getValue(); - } catch (Exception $e) { + } catch (Exception) { return null; } } else { @@ -596,7 +596,7 @@ public function prepareOptionValueForRequest($optionValue) { try { return Mage::helper('core/unserializeArray')->unserialize($optionValue); - } catch (Exception $e) { + } catch (Exception) { return null; } } @@ -625,7 +625,7 @@ public function copyQuoteToOrder() $this->_createWriteableDir($dir); Mage::helper('core/file_storage_database')->copyFile($quoteFileFullPath, $orderFileFullPath); @copy($quoteFileFullPath, $orderFileFullPath); - } catch (Exception $e) { + } catch (Exception) { return $this; } return $this; diff --git a/app/code/core/Mage/Catalog/Model/Product/Website.php b/app/code/core/Mage/Catalog/Model/Product/Website.php index 21cbc6aa0b5..141b66a7ff7 100644 --- a/app/code/core/Mage/Catalog/Model/Product/Website.php +++ b/app/code/core/Mage/Catalog/Model/Product/Website.php @@ -38,7 +38,7 @@ public function removeProducts($websiteIds, $productIds) { try { $this->_getResource()->removeProducts($websiteIds, $productIds); - } catch (Exception $e) { + } catch (Exception) { Mage::throwException( Mage::helper('catalog')->__('An error occurred while removing products from websites.'), ); @@ -57,7 +57,7 @@ public function addProducts($websiteIds, $productIds) { try { $this->_getResource()->addProducts($websiteIds, $productIds); - } catch (Exception $e) { + } catch (Exception) { Mage::throwException( Mage::helper('catalog')->__('An error occurred while adding products to websites.'), ); diff --git a/app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php b/app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php index fb21e411a9a..fd489207292 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Category/Flat.php @@ -453,7 +453,7 @@ public function isBuilt($storeView = null) ->limit(1); try { $this->_isBuilt[$storeId] = (bool) $this->_getReadAdapter()->fetchOne($select); - } catch (Exception $e) { + } catch (Exception) { $this->_isBuilt[$storeId] = false; } } diff --git a/app/code/core/Mage/Catalog/Model/Resource/Product/Flat.php b/app/code/core/Mage/Catalog/Model/Resource/Product/Flat.php index 0eefb081521..3f68e21d588 100644 --- a/app/code/core/Mage/Catalog/Model/Resource/Product/Flat.php +++ b/app/code/core/Mage/Catalog/Model/Resource/Product/Flat.php @@ -227,7 +227,7 @@ public function isBuilt($storeView = null) ->limit(1); try { $this->_isBuilt[$storeId] = (bool) $this->_getReadAdapter()->fetchOne($select); - } catch (Exception $e) { + } catch (Exception) { $this->_isBuilt[$storeId] = false; } } diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.35-0.7.36.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.35-0.7.36.php index 908578cc717..88fa4d5ce99 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.35-0.7.36.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.35-0.7.36.php @@ -16,7 +16,7 @@ ALTER TABLE `{$installer->getTable('catalog_category_entity')}` ADD `level` INT NOT NULL; ALTER TABLE `{$installer->getTable('catalog_category_entity')}` ADD INDEX `IDX_LEVEL` ( `level` ); "); -} catch (Exception $e) { +} catch (Exception) { } $installer->rebuildCategoryLevels(); diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.36-0.7.37.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.36-0.7.37.php index 9a4f755686a..c619979b750 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.36-0.7.37.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.36-0.7.37.php @@ -25,7 +25,7 @@ REFERENCES `{$installer->getTable('core_website')}` (`website_id`) ON DELETE CASCADE ON UPDATE CASCADE, ROW_FORMAT = DYNAMIC; "); -} catch (Exception $e) { +} catch (Exception) { } $installer->endSetup(); diff --git a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.4-0.7.5.php b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.4-0.7.5.php index b068726153a..9141f38e420 100644 --- a/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.4-0.7.5.php +++ b/app/code/core/Mage/Catalog/sql/catalog_setup/mysql4-upgrade-0.7.4-0.7.5.php @@ -41,7 +41,7 @@ WHERE cs.store_id=ps.store_id AND ps.store_id>0; DROP TABLE IF EXISTS {$this->getTable('catalog_product_store')}; "); -} catch (Exception $e) { +} catch (Exception) { } $categoryTable = $this->getTable('catalog/category'); @@ -49,11 +49,11 @@ try { $this->run("ALTER TABLE `{$this->getTable('catalog/category')}` ADD `path` VARCHAR( 255 ) NOT NULL, ADD `position` INT NOT NULL;"); -} catch (Exception $e) { +} catch (Exception) { } try { $this->run("DROP TABLE IF EXISTS `{$this->getTable('catalog/category_tree')}`;"); -} catch (Exception $e) { +} catch (Exception) { } $installer->getConnection()->dropKey($categoryTable, 'FK_catalog_category_ENTITY_ENTITY_TYPE'); diff --git a/app/code/core/Mage/CatalogInventory/Helper/Minsaleqty.php b/app/code/core/Mage/CatalogInventory/Helper/Minsaleqty.php index 01cc27dc790..6189239bbda 100644 --- a/app/code/core/Mage/CatalogInventory/Helper/Minsaleqty.php +++ b/app/code/core/Mage/CatalogInventory/Helper/Minsaleqty.php @@ -69,7 +69,7 @@ protected function _unserializeValue($value) } elseif (is_string($value) && !empty($value)) { try { return Mage::helper('core/unserializeArray')->unserialize($value); - } catch (Exception $e) { + } catch (Exception) { return []; } } else { diff --git a/app/code/core/Mage/CatalogInventory/Model/Api2/Stock/Item/Rest.php b/app/code/core/Mage/CatalogInventory/Model/Api2/Stock/Item/Rest.php index 4ac5a025ccc..190d370f82c 100644 --- a/app/code/core/Mage/CatalogInventory/Model/Api2/Stock/Item/Rest.php +++ b/app/code/core/Mage/CatalogInventory/Model/Api2/Stock/Item/Rest.php @@ -124,7 +124,7 @@ protected function _multiUpdate(array $data) 'item_id' => $itemData['item_id'] ?? null, ]); } - } catch (Exception $e) { + } catch (Exception) { $this->_errorMessage( Mage_Api2_Model_Resource::RESOURCE_INTERNAL_ERROR, Mage_Api2_Model_Server::HTTP_INTERNAL_ERROR, diff --git a/app/code/core/Mage/Centinel/controllers/Adminhtml/Centinel/IndexController.php b/app/code/core/Mage/Centinel/controllers/Adminhtml/Centinel/IndexController.php index 3132aba00c1..b8e3ef66be1 100644 --- a/app/code/core/Mage/Centinel/controllers/Adminhtml/Centinel/IndexController.php +++ b/app/code/core/Mage/Centinel/controllers/Adminhtml/Centinel/IndexController.php @@ -74,7 +74,7 @@ public function authenticationCompleteAction() $validator->authenticate($data); Mage::register('current_centinel_validator', $validator); } - } catch (Exception $e) { + } catch (Exception) { Mage::register('current_centinel_validator', false); } $this->loadLayout()->renderLayout(); diff --git a/app/code/core/Mage/Centinel/controllers/IndexController.php b/app/code/core/Mage/Centinel/controllers/IndexController.php index 80ccdacdf00..8bfe49766b5 100644 --- a/app/code/core/Mage/Centinel/controllers/IndexController.php +++ b/app/code/core/Mage/Centinel/controllers/IndexController.php @@ -43,7 +43,7 @@ public function authenticationCompleteAction() $validator->authenticate($data); Mage::register('current_centinel_validator', $validator); } - } catch (Exception $e) { + } catch (Exception) { Mage::register('current_centinel_validator', false); } $this->loadLayout()->renderLayout(); diff --git a/app/code/core/Mage/Checkout/Model/Api/Resource.php b/app/code/core/Mage/Checkout/Model/Api/Resource.php index e2de51c3064..09ec9cb3eca 100644 --- a/app/code/core/Mage/Checkout/Model/Api/Resource.php +++ b/app/code/core/Mage/Checkout/Model/Api/Resource.php @@ -52,7 +52,7 @@ protected function _isQuoteExist($quoteId) try { $quote = $this->_getQuote($quoteId); - } catch (Mage_Api_Exception $e) { + } catch (Mage_Api_Exception) { return false; } @@ -79,7 +79,7 @@ protected function _getStoreId($store = null) try { $storeId = Mage::app()->getStore($store)->getId(); - } catch (Mage_Core_Model_Store_Exception $e) { + } catch (Mage_Core_Model_Store_Exception) { $this->_fault('store_not_exists'); } diff --git a/app/code/core/Mage/Checkout/Model/Cart.php b/app/code/core/Mage/Checkout/Model/Cart.php index 67112d2f13a..e88a6e0624e 100644 --- a/app/code/core/Mage/Checkout/Model/Cart.php +++ b/app/code/core/Mage/Checkout/Model/Cart.php @@ -298,7 +298,7 @@ public function addProductsByIds($productIds) if ($product->getId() && $product->isVisibleInCatalog()) { try { $this->getQuote()->addProduct($product); - } catch (Exception $e) { + } catch (Exception) { $allAdded = false; } } else { diff --git a/app/code/core/Mage/Checkout/controllers/CartController.php b/app/code/core/Mage/Checkout/controllers/CartController.php index d2cc366ae21..4030f8398c6 100644 --- a/app/code/core/Mage/Checkout/controllers/CartController.php +++ b/app/code/core/Mage/Checkout/controllers/CartController.php @@ -643,7 +643,7 @@ public function ajaxDeleteAction() $result['success'] = 1; $result['message'] = $this->__('Item was removed successfully.'); Mage::dispatchEvent('ajax_cart_remove_item_success', ['id' => $id]); - } catch (Exception $e) { + } catch (Exception) { $result['success'] = 0; $result['error'] = $this->__('Can not remove the item.'); } @@ -696,7 +696,7 @@ public function ajaxUpdateAction() $result['notice'] = $quoteItem->getMessage(); } $result['success'] = 1; - } catch (Exception $e) { + } catch (Exception) { $result['success'] = 0; $result['error'] = $this->__('Can not save item.'); } diff --git a/app/code/core/Mage/Core/Helper/String.php b/app/code/core/Mage/Core/Helper/String.php index 7a084989284..0822dab337e 100644 --- a/app/code/core/Mage/Core/Helper/String.php +++ b/app/code/core/Mage/Core/Helper/String.php @@ -554,7 +554,7 @@ public function validateSerializedObject($str) if ($this->isSerializedArrayOrObject($str)) { try { $this->unserialize($str); - } catch (Exception $e) { + } catch (Exception) { return false; } } diff --git a/app/code/core/Mage/Core/Model/App.php b/app/code/core/Mage/Core/Model/App.php index 422c2830cb8..19d0dd52abe 100644 --- a/app/code/core/Mage/Core/Model/App.php +++ b/app/code/core/Mage/Core/Model/App.php @@ -889,7 +889,7 @@ public function getSafeStore($id = null) { try { return $this->getStore($id); - } catch (Exception $e) { + } catch (Exception) { if ($this->_currentStore) { $this->getRequest()->setActionName('noRoute'); return new Varien_Object(); diff --git a/app/code/core/Mage/Core/Model/Cache.php b/app/code/core/Mage/Core/Model/Cache.php index c689dcea1e4..3f95333372f 100644 --- a/app/code/core/Mage/Core/Model/Cache.php +++ b/app/code/core/Mage/Core/Model/Cache.php @@ -198,7 +198,7 @@ protected function _getBackendOptions(array $cacheOptions) } } } - } catch (Exception $e) { + } catch (Exception) { } } } diff --git a/app/code/core/Mage/Core/Model/Layout/Validator.php b/app/code/core/Mage/Core/Model/Layout/Validator.php index d6f10d7b79a..7e738f2eb7c 100644 --- a/app/code/core/Mage/Core/Model/Layout/Validator.php +++ b/app/code/core/Mage/Core/Model/Layout/Validator.php @@ -135,7 +135,7 @@ public function isValid($value) $value = trim($value); try { $value = new Varien_Simplexml_Element('' . $value . ''); - } catch (Exception $e) { + } catch (Exception) { $this->_error(self::XML_INVALID); return false; } @@ -150,7 +150,7 @@ public function isValid($value) if ($templatePaths = $value->xpath($this->getXpathValidationExpression())) { try { $this->validateTemplatePath($templatePaths); - } catch (Exception $e) { + } catch (Exception) { $this->_error(self::INVALID_TEMPLATE_PATH); return false; } diff --git a/app/code/core/Mage/Core/Model/Locale.php b/app/code/core/Mage/Core/Model/Locale.php index e8a9bd9a761..65bc14192de 100644 --- a/app/code/core/Mage/Core/Model/Locale.php +++ b/app/code/core/Mage/Core/Model/Locale.php @@ -600,7 +600,7 @@ public function currency($currency) $options = []; try { $currencyObject = new Zend_Currency($currency, $this->getLocale()); - } catch (Exception $e) { + } catch (Exception) { /** * catch specific exceptions like "Currency 'USD' not found" * - back end falls with specific locals as Malaysia and etc. diff --git a/app/code/core/Mage/Core/Model/Store/Api.php b/app/code/core/Mage/Core/Model/Store/Api.php index 9f3ad6a64ce..734dd5733df 100644 --- a/app/code/core/Mage/Core/Model/Store/Api.php +++ b/app/code/core/Mage/Core/Model/Store/Api.php @@ -52,7 +52,7 @@ public function info($storeId) // Retrieve store info try { $store = Mage::app()->getStore($storeId); - } catch (Mage_Core_Model_Store_Exception $e) { + } catch (Mage_Core_Model_Store_Exception) { $this->_fault('store_not_exists'); } diff --git a/app/code/core/Mage/Core/Model/Translate.php b/app/code/core/Mage/Core/Model/Translate.php index 67d8313e40f..140aab98f03 100644 --- a/app/code/core/Mage/Core/Model/Translate.php +++ b/app/code/core/Mage/Core/Model/Translate.php @@ -403,7 +403,7 @@ public function translate($args) try { $result = !empty($args) ? vsprintf($translated, $args) : false; - } catch (ValueError $e) { + } catch (ValueError) { $result = false; } diff --git a/app/code/core/Mage/Core/Model/Url/Rewrite.php b/app/code/core/Mage/Core/Model/Url/Rewrite.php index 51e546682ab..c855020536d 100644 --- a/app/code/core/Mage/Core/Model/Url/Rewrite.php +++ b/app/code/core/Mage/Core/Model/Url/Rewrite.php @@ -244,7 +244,7 @@ public function rewrite(?Zend_Controller_Request_Http $request = null, ?Zend_Con if (!$this->getId() && isset($_GET['___from_store'])) { try { $fromStoreId = Mage::app()->getStore($_GET['___from_store'])->getId(); - } catch (Exception $e) { + } catch (Exception) { return false; } diff --git a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.4-0.8.5.php b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.4-0.8.5.php index b9ac93a1b64..bd965358108 100644 --- a/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.4-0.8.5.php +++ b/app/code/core/Mage/Core/sql/core_setup/mysql4-upgrade-0.8.4-0.8.5.php @@ -15,7 +15,7 @@ try { $conn->addColumn($table, 'design', "varchar(255) not null default ''"); -} catch (Exception $e) { +} catch (Exception) { } $conn->dropColumn($table, 'package'); diff --git a/app/code/core/Mage/Customer/Helper/Data.php b/app/code/core/Mage/Customer/Helper/Data.php index 0d9c6503719..d9d52ac445b 100644 --- a/app/code/core/Mage/Customer/Helper/Data.php +++ b/app/code/core/Mage/Customer/Helper/Data.php @@ -577,7 +577,7 @@ public function checkVatNumber($countryCode, $vatNumber, $requesterCountryCode = $gatewayResponse->setRequestDate((string) $result->requestDate); $gatewayResponse->setRequestIdentifier((string) $result->requestIdentifier); $gatewayResponse->setRequestSuccess(true); - } catch (Exception $exception) { + } catch (Exception) { $gatewayResponse->setIsValid(false); $gatewayResponse->setRequestDate(''); $gatewayResponse->setRequestIdentifier(''); diff --git a/app/code/core/Mage/Customer/Model/Observer.php b/app/code/core/Mage/Customer/Model/Observer.php index 626c7eec299..2ad7aff5a4d 100644 --- a/app/code/core/Mage/Customer/Model/Observer.php +++ b/app/code/core/Mage/Customer/Model/Observer.php @@ -178,7 +178,7 @@ public function afterAddressSave($observer) } } } - } catch (Exception $e) { + } catch (Exception) { Mage::register(self::VIV_PROCESSED_FLAG, false, true); } } diff --git a/app/code/core/Mage/Customer/controllers/AccountController.php b/app/code/core/Mage/Customer/controllers/AccountController.php index afdf9172bdb..b7ecb5995aa 100644 --- a/app/code/core/Mage/Customer/controllers/AccountController.php +++ b/app/code/core/Mage/Customer/controllers/AccountController.php @@ -161,7 +161,7 @@ public function loginPostAction() } $session->addError($message); $session->setUsername($login['username']); - } catch (Exception $e) { + } catch (Exception) { // Mage::logException($e); // PA DSS violation: this exception log can disclose customer password } } else { @@ -617,7 +617,7 @@ public function confirmAction() try { $customer->setConfirmation(null); $customer->save(); - } catch (Exception $e) { + } catch (Exception) { throw new Exception($this->__('Failed to confirm customer account.')); } @@ -788,7 +788,7 @@ public function changeForgottenAction() $this->_validateResetPasswordLinkToken($customerId, $resetPasswordLinkToken); $this->loadLayout(); $this->renderLayout(); - } catch (Exception $exception) { + } catch (Exception) { $this->_getSession()->addError($this->_getHelper('customer')->__('Your password reset link has expired.')); $this->_redirect('*/*/forgotpassword'); } @@ -809,7 +809,7 @@ public function resetPasswordAction() $this->_validateResetPasswordLinkToken($customerId, $resetPasswordLinkToken); $this->_saveRestorePasswordParameters($customerId, $resetPasswordLinkToken) ->_redirect('*/*/changeforgotten'); - } catch (Exception $exception) { + } catch (Exception) { $this->_getSession()->addError($this->_getHelper('customer')->__('Your password reset link has expired.')); $this->_redirect('*/*/forgotpassword'); } diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Container/Abstract.php b/app/code/core/Mage/Dataflow/Model/Convert/Container/Abstract.php index c833eff136e..5e124fdf0fd 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Container/Abstract.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Container/Abstract.php @@ -119,7 +119,7 @@ public function validateDataSerialized($data = null) if ($this->isSerialized($data)) { try { Mage::helper('core/unserializeArray')->unserialize($data); - } catch (Exception $e) { + } catch (Exception) { $result = false; $this->addException( 'Invalid data, expecting serialized array.', diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php index 89fe7eb2004..282829a8bd0 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Csv.php @@ -44,7 +44,7 @@ public function parse() try { $adapter = Mage::getModel($adapterName); - } catch (Exception $e) { + } catch (Exception) { $message = Mage::helper('dataflow') ->__('Declared adapter %s was not found.', $adapterName); $this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL); diff --git a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Xml/Excel.php b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Xml/Excel.php index cacec5bf859..57323582802 100644 --- a/app/code/core/Mage/Dataflow/Model/Convert/Parser/Xml/Excel.php +++ b/app/code/core/Mage/Dataflow/Model/Convert/Parser/Xml/Excel.php @@ -41,7 +41,7 @@ public function parse() try { $adapter = Mage::getModel($adapterName); - } catch (Exception $e) { + } catch (Exception) { $message = Mage::helper('dataflow')->__('Declared adapter %s was not found.', $adapterName); $this->addException($message, Mage_Dataflow_Model_Convert_Exception::FATAL); return $this; @@ -194,7 +194,7 @@ protected function _saveParsedRow($xmlString) try { $xmlElement = new SimpleXMLElement($xml); - } catch (Exception $e) { + } catch (Exception) { $message = 'Invalid XML row'; $this->addException($message, Mage_Dataflow_Model_Convert_Exception::ERROR); return $this; diff --git a/app/code/core/Mage/Dataflow/Model/Profile.php b/app/code/core/Mage/Dataflow/Model/Profile.php index 1ce96d44391..77f05ee35a9 100644 --- a/app/code/core/Mage/Dataflow/Model/Profile.php +++ b/app/code/core/Mage/Dataflow/Model/Profile.php @@ -192,7 +192,7 @@ protected function _afterSave() foreach ($cells as $cell) { $fileData[] = $this->getNode($cell, 'Data')->item(0)->nodeValue; } - } catch (Exception $e) { + } catch (Exception) { foreach ($newUploadedFilenames as $k => $v) { unlink($path . $v); } diff --git a/app/code/core/Mage/Directory/Model/Currency/Import/Currencyconverterapi.php b/app/code/core/Mage/Directory/Model/Currency/Import/Currencyconverterapi.php index 8280c3a4675..00002d69ea2 100644 --- a/app/code/core/Mage/Directory/Model/Currency/Import/Currencyconverterapi.php +++ b/app/code/core/Mage/Directory/Model/Currency/Import/Currencyconverterapi.php @@ -115,7 +115,7 @@ protected function _convertBatch(array $data, $currencyFrom, array $currenciesTo @set_time_limit($timeLimitCalculated); try { $response = $this->_getServiceResponse($url); - } catch (Exception $e) { + } catch (Exception) { ini_restore('max_execution_time'); } @@ -153,7 +153,7 @@ protected function _getServiceResponse($url, $retry = 0) ->getBody(); $response = json_decode($jsonResponse, true); - } catch (Exception $e) { + } catch (Exception) { if ($retry === 0) { $response = $this->_getServiceResponse($url, 1); } diff --git a/app/code/core/Mage/Directory/Model/Currency/Import/Fixerio.php b/app/code/core/Mage/Directory/Model/Currency/Import/Fixerio.php index 461f9e7f805..7c837a9e52e 100644 --- a/app/code/core/Mage/Directory/Model/Currency/Import/Fixerio.php +++ b/app/code/core/Mage/Directory/Model/Currency/Import/Fixerio.php @@ -114,7 +114,7 @@ protected function _convertBatch(array $data, $currencyFrom, array $currenciesTo @set_time_limit($timeLimitCalculated); try { $response = $this->_getServiceResponse($url); - } catch (Exception $e) { + } catch (Exception) { ini_restore('max_execution_time'); } @@ -158,7 +158,7 @@ protected function _getServiceResponse($url, $retry = 0) ->getBody(); $response = json_decode($jsonResponse, true); - } catch (Exception $e) { + } catch (Exception) { if ($retry === 0) { $response = $this->_getServiceResponse($url, 1); } diff --git a/app/code/core/Mage/Directory/Model/Currency/Import/Webservicex.php b/app/code/core/Mage/Directory/Model/Currency/Import/Webservicex.php index ba4fe8830fe..76cf4f676d9 100644 --- a/app/code/core/Mage/Directory/Model/Currency/Import/Webservicex.php +++ b/app/code/core/Mage/Directory/Model/Currency/Import/Webservicex.php @@ -54,7 +54,7 @@ protected function _convert($currencyFrom, $currencyTo, $retry = 0) return null; } return (float) $xml; - } catch (Exception $e) { + } catch (Exception) { if ($retry == 0) { $this->_convert($currencyFrom, $currencyTo, 1); } else { diff --git a/app/code/core/Mage/Directory/Model/Observer.php b/app/code/core/Mage/Directory/Model/Observer.php index bd8a58b079d..55f5b7511f5 100644 --- a/app/code/core/Mage/Directory/Model/Observer.php +++ b/app/code/core/Mage/Directory/Model/Observer.php @@ -40,7 +40,7 @@ public function scheduledUpdateCurrencyRates() try { /** @var Mage_Directory_Model_Currency_Import_Abstract $importModel */ $importModel = Mage::getModel(Mage::getConfig()->getNode('global/currency/import/services/' . $service . '/model')->asArray()); - } catch (Exception $e) { + } catch (Exception) { $importWarnings[] = Mage::helper('directory')->__('FATAL ERROR:') . ' ' . Mage::throwException(Mage::helper('directory')->__('Unable to initialize the import model.')); } diff --git a/app/code/core/Mage/Downloadable/Helper/File.php b/app/code/core/Mage/Downloadable/Helper/File.php index 1d5f114a3e3..b3a34f31d98 100644 --- a/app/code/core/Mage/Downloadable/Helper/File.php +++ b/app/code/core/Mage/Downloadable/Helper/File.php @@ -66,7 +66,7 @@ public function moveFileFromTmp($baseTmpPath, $basePath, $file) $basePath, $file[0]['file'], ); - } catch (Exception $e) { + } catch (Exception) { Mage::throwException(Mage::helper('downloadable')->__('An error occurred while saving the file(s).')); } } @@ -89,7 +89,7 @@ protected function _moveFileFromTmp($baseTmpPath, $basePath, $file) $destDirectory = dirname($this->getFilePath($basePath, $file)); try { $ioObject->open(['path' => $destDirectory]); - } catch (Exception $e) { + } catch (Exception) { $ioObject->mkdir($destDirectory, 0777, true); $ioObject->open(['path' => $destDirectory]); } diff --git a/app/code/core/Mage/Downloadable/controllers/Adminhtml/Downloadable/Product/EditController.php b/app/code/core/Mage/Downloadable/controllers/Adminhtml/Downloadable/Product/EditController.php index 8f7c5b7a4c8..8417f9c1239 100644 --- a/app/code/core/Mage/Downloadable/controllers/Adminhtml/Downloadable/Product/EditController.php +++ b/app/code/core/Mage/Downloadable/controllers/Adminhtml/Downloadable/Product/EditController.php @@ -98,7 +98,7 @@ public function linkAction() } try { $this->_processDownload($resource, $resourceType); - } catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception) { $this->_getSession()->addError(Mage::helper('downloadable')->__('An error occurred while getting the requested content.')); } } diff --git a/app/code/core/Mage/Downloadable/controllers/DownloadController.php b/app/code/core/Mage/Downloadable/controllers/DownloadController.php index 7ba8c42f643..5bdc36bc371 100644 --- a/app/code/core/Mage/Downloadable/controllers/DownloadController.php +++ b/app/code/core/Mage/Downloadable/controllers/DownloadController.php @@ -101,7 +101,7 @@ public function sampleAction() try { $this->_processDownload($resource, $resourceType); exit(0); - } catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception) { $this->_getSession()->addError(Mage::helper('downloadable')->__('Sorry, there was an error getting requested content. Please contact the store owner.')); } } @@ -137,7 +137,7 @@ public function linkSampleAction() try { $this->_processDownload($resource, $resourceType); exit(0); - } catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception) { $this->_getCustomerSession()->addError(Mage::helper('downloadable')->__('Sorry, there was an error getting requested content. Please contact the store owner.')); } } @@ -209,7 +209,7 @@ public function linkAction() } $linkPurchasedItem->save(); exit(0); - } catch (Exception $e) { + } catch (Exception) { $this->_getCustomerSession()->addError( Mage::helper('downloadable')->__('An error occurred while getting the requested content. Please contact the store owner.'), ); diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute.php b/app/code/core/Mage/Eav/Model/Entity/Attribute.php index 9fa0dbdacec..a3329d0d5d1 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute.php @@ -160,7 +160,7 @@ protected function _beforeSave() ['locale' => Mage::app()->getLocale()->getLocaleCode()], ); $this->setDefaultValue($filter->filter($defaultValue)); - } catch (Exception $e) { + } catch (Exception) { throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid default decimal value')); } } @@ -180,7 +180,7 @@ protected function _beforeSave() try { $defaultValue = Mage::app()->getLocale()->date($defaultValue, $format, null, false)->toValue(); $this->setDefaultValue($defaultValue); - } catch (Exception $e) { + } catch (Exception) { throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid default date')); } } diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Datetime.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Datetime.php index d3128a0de52..8d9bb953a26 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Datetime.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Datetime.php @@ -29,7 +29,7 @@ public function beforeSave($object) if (!$_formated && $object->hasData($attributeName)) { try { $value = $this->formatDate($object->getData($attributeName)); - } catch (Exception $e) { + } catch (Exception) { throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid date')); } diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Serialized.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Serialized.php index 163dd82c19f..d44c338fe58 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Serialized.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Serialized.php @@ -70,7 +70,7 @@ protected function _unserialize(Varien_Object $object) $unserialized = Mage::helper('core/string') ->unserialize($object->getData($attrCode)); $object->setData($attrCode, $unserialized); - } catch (Exception $e) { + } catch (Exception) { $object->unsetData($attrCode); } } diff --git a/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Datetime.php b/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Datetime.php index f6cc771cc3f..22a74c1f884 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Datetime.php +++ b/app/code/core/Mage/Eav/Model/Entity/Attribute/Frontend/Datetime.php @@ -28,7 +28,7 @@ public function getValue(Varien_Object $object) if ($value) { try { $data = Mage::getSingleton('core/locale')->date($value, Zend_Date::ISO_8601, null, false)->toString($format); - } catch (Exception $e) { + } catch (Exception) { $data = Mage::getSingleton('core/locale')->date($value, null, null, false)->toString($format); } } diff --git a/app/code/core/Mage/Eav/Model/Entity/Setup.php b/app/code/core/Mage/Eav/Model/Entity/Setup.php index 4fc86c2ed77..bcf7d88b8b6 100644 --- a/app/code/core/Mage/Eav/Model/Entity/Setup.php +++ b/app/code/core/Mage/Eav/Model/Entity/Setup.php @@ -1443,7 +1443,7 @@ public function createEntityTables($baseTableName, array $options = []) foreach ($tables as $tableName => $table) { $connection->createTable($table); } - } catch (Exception $e) { + } catch (Exception) { throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Can\'t create table: %s', $tableName)); } diff --git a/app/code/core/Mage/GiftMessage/Model/Observer.php b/app/code/core/Mage/GiftMessage/Model/Observer.php index dd8f4f04897..4a954df5f02 100644 --- a/app/code/core/Mage/GiftMessage/Model/Observer.php +++ b/app/code/core/Mage/GiftMessage/Model/Observer.php @@ -120,7 +120,7 @@ public function checkoutEventCreateGiftMessage(Varien_Event_Observer $observer) $giftMessage->delete(); $entity->setGiftMessageId(0) ->save(); - } catch (Exception $e) { + } catch (Exception) { } } continue; @@ -134,7 +134,7 @@ public function checkoutEventCreateGiftMessage(Varien_Event_Observer $observer) $entity->setGiftMessageId($giftMessage->getId()) ->save(); - } catch (Exception $e) { + } catch (Exception) { } } } diff --git a/app/code/core/Mage/GiftMessage/controllers/IndexController.php b/app/code/core/Mage/GiftMessage/controllers/IndexController.php index 963a7087f42..708d12c2980 100644 --- a/app/code/core/Mage/GiftMessage/controllers/IndexController.php +++ b/app/code/core/Mage/GiftMessage/controllers/IndexController.php @@ -33,7 +33,7 @@ public function saveAction() $this->getRequest()->setParam('message', $giftMessage->getId()); $this->getRequest()->setParam('entity', $entity); - } catch (Exception $e) { + } catch (Exception) { } $this->loadLayout(); diff --git a/app/code/core/Mage/ImportExport/Model/Export/Entity/Abstract.php b/app/code/core/Mage/ImportExport/Model/Export/Entity/Abstract.php index 7eb3c77a6d4..34af5789d44 100644 --- a/app/code/core/Mage/ImportExport/Model/Export/Entity/Abstract.php +++ b/app/code/core/Mage/ImportExport/Model/Export/Entity/Abstract.php @@ -411,7 +411,7 @@ public function getAttributeOptions(Mage_Eav_Model_Entity_Attribute_Abstract $at } } } - } catch (Exception $e) { + } catch (Exception) { // ignore exceptions connected with source models } } diff --git a/app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php b/app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php index fb2a8f38028..00648954ae6 100644 --- a/app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php +++ b/app/code/core/Mage/ImportExport/Model/Import/Entity/Abstract.php @@ -357,7 +357,7 @@ public function getAttributeOptions(Mage_Eav_Model_Entity_Attribute_Abstract $at } } } - } catch (Exception $e) { + } catch (Exception) { // ignore exceptions connected with source models } } diff --git a/app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php b/app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php index 5014ffd9c36..6d3eb74292c 100644 --- a/app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php +++ b/app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php @@ -1715,7 +1715,7 @@ protected function _uploadMediaFiles($fileName) try { $res = $this->_getUploader()->move($fileName); return $res['file']; - } catch (Exception $e) { + } catch (Exception) { return ''; } } @@ -1789,7 +1789,7 @@ protected function _saveMediaGallery(array $mediaGalleryData) try { $this->_connection ->insertOnDuplicate($mediaValueTableName, $valueArr, ['value_id']); - } catch (Exception $e) { + } catch (Exception) { $this->_connection->delete( $mediaGalleryTableName, $this->_connection->quoteInto('value_id IN (?)', $newMediaValues), diff --git a/app/code/core/Mage/ImportExport/Model/Resource/Helper/Mysql4.php b/app/code/core/Mage/ImportExport/Model/Resource/Helper/Mysql4.php index 878dadc495d..2a3ee93fa27 100644 --- a/app/code/core/Mage/ImportExport/Model/Resource/Helper/Mysql4.php +++ b/app/code/core/Mage/ImportExport/Model/Resource/Helper/Mysql4.php @@ -65,7 +65,7 @@ public function setInformationSchemaStatsExpiry(): void if (!self::$instantInformationSchemaStatsExpiry) { try { $this->_getReadAdapter()->query('SET information_schema_stats_expiry = 0;'); - } catch (Exception $e) { + } catch (Exception) { } self::$instantInformationSchemaStatsExpiry = true; } diff --git a/app/code/core/Mage/Index/Model/Process.php b/app/code/core/Mage/Index/Model/Process.php index 43e854fa7b8..34fc59dc559 100644 --- a/app/code/core/Mage/Index/Model/Process.php +++ b/app/code/core/Mage/Index/Model/Process.php @@ -266,7 +266,7 @@ public function processEvent(Mage_Index_Model_Event $event) try { $this->getIndexer()->processEvent($event); - } catch (Exception $e) { + } catch (Exception) { $isError = true; } $event->resetData(); @@ -374,7 +374,7 @@ protected function _processEventsCollection( $event->addProcessId($this->getId()); } } - } catch (Exception $e) { + } catch (Exception) { $event->addProcessId($this->getId(), self::EVENT_STATUS_ERROR); } $event->save(); diff --git a/app/code/core/Mage/Install/Model/Installer.php b/app/code/core/Mage/Install/Model/Installer.php index 5c39f4e873e..3b822993612 100644 --- a/app/code/core/Mage/Install/Model/Installer.php +++ b/app/code/core/Mage/Install/Model/Installer.php @@ -74,7 +74,7 @@ public function checkServer() Mage::getModel('install/installer_env')->install(); $result = true; - } catch (Exception $e) { + } catch (Exception) { $result = false; } $this->setData('server_check_status', $result); diff --git a/app/code/core/Mage/Newsletter/Model/Resource/Queue.php b/app/code/core/Mage/Newsletter/Model/Resource/Queue.php index 921cd327c0e..8fa4c5d8b41 100644 --- a/app/code/core/Mage/Newsletter/Model/Resource/Queue.php +++ b/app/code/core/Mage/Newsletter/Model/Resource/Queue.php @@ -52,7 +52,7 @@ public function addSubscribersToQueue(Mage_Newsletter_Model_Queue $queue, array $adapter->insert($this->getTable('newsletter/queue_link'), $data); } $adapter->commit(); - } catch (Exception $e) { + } catch (Exception) { $adapter->rollBack(); } } @@ -73,7 +73,7 @@ public function removeSubscribersFromQueue(Mage_Newsletter_Model_Queue $queue) ); $adapter->commit(); - } catch (Exception $e) { + } catch (Exception) { $adapter->rollBack(); } } diff --git a/app/code/core/Mage/Newsletter/Model/Resource/Subscriber.php b/app/code/core/Mage/Newsletter/Model/Resource/Subscriber.php index 597edba4234..eb58ecc5dbb 100644 --- a/app/code/core/Mage/Newsletter/Model/Resource/Subscriber.php +++ b/app/code/core/Mage/Newsletter/Model/Resource/Subscriber.php @@ -144,7 +144,7 @@ public function received(Mage_Newsletter_Model_Subscriber $subscriber, Mage_News 'queue_id = ?' => $queue->getId(), ]); $this->_write->commit(); - } catch (Exception $e) { + } catch (Exception) { $this->_write->rollBack(); Mage::throwException(Mage::helper('newsletter')->__('Cannot mark as received subscriber.')); } diff --git a/app/code/core/Mage/Newsletter/controllers/ManageController.php b/app/code/core/Mage/Newsletter/controllers/ManageController.php index 184cdefc6e3..149f5ea0a04 100644 --- a/app/code/core/Mage/Newsletter/controllers/ManageController.php +++ b/app/code/core/Mage/Newsletter/controllers/ManageController.php @@ -56,7 +56,7 @@ public function saveAction() } else { Mage::getSingleton('customer/session')->addSuccess($this->__('The subscription has been removed.')); } - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('customer/session')->addError($this->__('An error occurred while saving your subscription.')); } $this->_redirect('customer/account/'); diff --git a/app/code/core/Mage/Paypal/Model/Direct.php b/app/code/core/Mage/Paypal/Model/Direct.php index 18ead435263..b82d1661d8e 100644 --- a/app/code/core/Mage/Paypal/Model/Direct.php +++ b/app/code/core/Mage/Paypal/Model/Direct.php @@ -328,7 +328,7 @@ protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount) try { $api->callGetTransactionDetails(); - } catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception) { // if we receive errors, but DoDirectPayment response is Success, then set Pending status for transaction $payment->setIsTransactionPending(true); } diff --git a/app/code/core/Mage/Paypal/Model/Payflowlink.php b/app/code/core/Mage/Paypal/Model/Payflowlink.php index efe87412d74..8f2825f1e6f 100644 --- a/app/code/core/Mage/Paypal/Model/Payflowlink.php +++ b/app/code/core/Mage/Paypal/Model/Payflowlink.php @@ -289,7 +289,7 @@ protected function _processOrder(Mage_Sales_Model_Order $order) ->load($order->getQuoteId()) ->setIsActive(false) ->save(); - } catch (Exception $e) { + } catch (Exception) { Mage::throwException(Mage::helper('paypal')->__('Can not send new order email.')); } } diff --git a/app/code/core/Mage/Paypal/Model/Resource/Report/Settlement.php b/app/code/core/Mage/Paypal/Model/Resource/Report/Settlement.php index ccdbfde4ab1..38b87532a7e 100644 --- a/app/code/core/Mage/Paypal/Model/Resource/Report/Settlement.php +++ b/app/code/core/Mage/Paypal/Model/Resource/Report/Settlement.php @@ -72,7 +72,7 @@ protected function _afterSave(Mage_Core_Model_Abstract $object) $adapter->insertMultiple($this->_rowsTable, $rows); } $adapter->commit(); - } catch (Exception $e) { + } catch (Exception) { $adapter->rollBack(); } } diff --git a/app/code/core/Mage/Reports/Model/Resource/Report/Abstract.php b/app/code/core/Mage/Reports/Model/Resource/Report/Abstract.php index 71f81f21b24..0615ef06622 100644 --- a/app/code/core/Mage/Reports/Model/Resource/Report/Abstract.php +++ b/app/code/core/Mage/Reports/Model/Resource/Report/Abstract.php @@ -210,7 +210,7 @@ protected function _makeConditionFromDateRangeSelect($select, $periodColumn) while ($date = $query->fetchColumn()) { $selectResult[] = $date; } - } catch (Exception $e) { + } catch (Exception) { $selectResult = false; } $selectResultCache[$cacheKey] = $selectResult; diff --git a/app/code/core/Mage/Review/Model/Resource/Review.php b/app/code/core/Mage/Review/Model/Resource/Review.php index 9998627b28c..02323ea840c 100644 --- a/app/code/core/Mage/Review/Model/Resource/Review.php +++ b/app/code/core/Mage/Review/Model/Resource/Review.php @@ -347,7 +347,7 @@ public function aggregate($object) $writeAdapter->insert($this->_aggregateTable, $data->getData()); } $writeAdapter->commit(); - } catch (Exception $e) { + } catch (Exception) { $writeAdapter->rollBack(); } } diff --git a/app/code/core/Mage/Review/controllers/ProductController.php b/app/code/core/Mage/Review/controllers/ProductController.php index 46f24c78bcf..86a5cc014c4 100644 --- a/app/code/core/Mage/Review/controllers/ProductController.php +++ b/app/code/core/Mage/Review/controllers/ProductController.php @@ -181,7 +181,7 @@ public function postAction() $review->aggregate(); $session->addSuccess($this->__('Your review has been accepted for moderation.')); - } catch (Exception $e) { + } catch (Exception) { $session->setFormData($data); $session->addError($this->__('Unable to post the review.')); } @@ -291,7 +291,7 @@ protected function _initProductLayout($product) if (!Mage::getModel('core/layout_validator')->isValid($customLayout)) { $customLayout = ''; } - } catch (Exception $e) { + } catch (Exception) { $customLayout = ''; } } diff --git a/app/code/core/Mage/Rule/Model/Condition/Product/Abstract.php b/app/code/core/Mage/Rule/Model/Condition/Product/Abstract.php index 642e2ed5e85..cd5900521b1 100644 --- a/app/code/core/Mage/Rule/Model/Condition/Product/Abstract.php +++ b/app/code/core/Mage/Rule/Model/Condition/Product/Abstract.php @@ -137,7 +137,7 @@ public function getAttributeObject() try { $obj = Mage::getSingleton('eav/config') ->getAttribute(Mage_Catalog_Model_Product::ENTITY, $this->getAttribute()); - } catch (Exception $e) { + } catch (Exception) { $obj = new Varien_Object(); $obj->setEntity(Mage::getResourceSingleton('catalog/product')) ->setFrontendInput('text'); diff --git a/app/code/core/Mage/Sales/Block/Order/Item/Renderer/Default.php b/app/code/core/Mage/Sales/Block/Order/Item/Renderer/Default.php index 4bc8975ebe1..778327280d5 100644 --- a/app/code/core/Mage/Sales/Block/Order/Item/Renderer/Default.php +++ b/app/code/core/Mage/Sales/Block/Order/Item/Renderer/Default.php @@ -116,7 +116,7 @@ public function getFormatedOptionValue($optionValue) try { $group = Mage::getModel('catalog/product_option')->groupFactory($optionInfo['option_type']); return ['value' => $group->getCustomizedView($optionInfo)]; - } catch (Exception $e) { + } catch (Exception) { return $_default; } } diff --git a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Api.php b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Api.php index 2674207ce41..6f4ec81b01f 100644 --- a/app/code/core/Mage/Sales/Model/Order/Creditmemo/Api.php +++ b/app/code/core/Mage/Sales/Model/Order/Creditmemo/Api.php @@ -210,7 +210,7 @@ public function cancel($creditmemoIncrementId) } try { $creditmemo->cancel()->save(); - } catch (Exception $e) { + } catch (Exception) { $this->_fault('status_not_changed', Mage::helper('sales')->__('Credit memo canceling problem.')); } diff --git a/app/code/core/Mage/Sales/Model/Order/Invoice/Api.php b/app/code/core/Mage/Sales/Model/Order/Invoice/Api.php index 01be1708e22..30e2a4b2f9d 100644 --- a/app/code/core/Mage/Sales/Model/Order/Invoice/Api.php +++ b/app/code/core/Mage/Sales/Model/Order/Invoice/Api.php @@ -213,7 +213,7 @@ public function capture($invoiceIncrementId) ->save(); } catch (Mage_Core_Exception $e) { $this->_fault('status_not_changed', $e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { $this->_fault('status_not_changed', Mage::helper('sales')->__('Invoice capturing problem.')); } @@ -250,7 +250,7 @@ public function void($invoiceIncrementId) ->save(); } catch (Mage_Core_Exception $e) { $this->_fault('status_not_changed', $e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { $this->_fault('status_not_changed', Mage::helper('sales')->__('Invoice void problem')); } @@ -286,7 +286,7 @@ public function cancel($invoiceIncrementId) ->save(); } catch (Mage_Core_Exception $e) { $this->_fault('status_not_changed', $e->getMessage()); - } catch (Exception $e) { + } catch (Exception) { $this->_fault('status_not_changed', Mage::helper('sales')->__('Invoice canceling problem.')); } diff --git a/app/code/core/Mage/Sales/Model/Order/Payment/Transaction.php b/app/code/core/Mage/Sales/Model/Order/Payment/Transaction.php index cff16ca70ad..2ef77291177 100644 --- a/app/code/core/Mage/Sales/Model/Order/Payment/Transaction.php +++ b/app/code/core/Mage/Sales/Model/Order/Payment/Transaction.php @@ -353,7 +353,7 @@ public function canVoidAuthorizationCompletely() return false; } return true; - } catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception) { // jam all logical exceptions, fallback to false } return false; diff --git a/app/code/core/Mage/Sales/Model/Quote/Address.php b/app/code/core/Mage/Sales/Model/Quote/Address.php index 6a5fc0813f9..364242e93f0 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Address.php +++ b/app/code/core/Mage/Sales/Model/Quote/Address.php @@ -1164,7 +1164,7 @@ public function getAppliedTaxes() } try { $return = Mage::helper('core/unserializeArray')->unserialize($tax); - } catch (Exception $e) { + } catch (Exception) { $return = []; } return $return; diff --git a/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php b/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php index 81af1dd1997..195d8ef23bf 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php +++ b/app/code/core/Mage/Sales/Model/Quote/Item/Abstract.php @@ -406,7 +406,7 @@ public function checkData() ->setMessage($e->getMessage()); $this->getQuote()->setHasError(true) ->addMessage(Mage::helper('sales')->__('Some of the products below do not have all the required options.')); - } catch (Exception $e) { + } catch (Exception) { $this->setHasError(true) ->setMessage(Mage::helper('sales')->__('Item options declaration error.')); $this->getQuote()->setHasError(true) diff --git a/app/code/core/Mage/Sales/Model/Quote/Payment.php b/app/code/core/Mage/Sales/Model/Quote/Payment.php index d91acd5549a..24c3c0b1bc9 100644 --- a/app/code/core/Mage/Sales/Model/Quote/Payment.php +++ b/app/code/core/Mage/Sales/Model/Quote/Payment.php @@ -166,7 +166,7 @@ protected function _beforeSave() } try { $method = $this->getMethodInstance(); - } catch (Mage_Core_Exception $e) { + } catch (Mage_Core_Exception) { return parent::_beforeSave(); } $method->prepareSave(); diff --git a/app/code/core/Mage/Sales/controllers/DownloadController.php b/app/code/core/Mage/Sales/controllers/DownloadController.php index f3e2613d09e..0057ea26a03 100644 --- a/app/code/core/Mage/Sales/controllers/DownloadController.php +++ b/app/code/core/Mage/Sales/controllers/DownloadController.php @@ -41,7 +41,7 @@ protected function _downloadFileAction($info) 'value' => $filePath, 'type' => 'filename', ]); - } catch (Exception $e) { + } catch (Exception) { $this->_forward('noRoute'); } } @@ -133,7 +133,7 @@ public function downloadProfileCustomOptionAction() return; } $this->_downloadFileAction($request['options'][$this->getRequest()->getParam('option_id')]); - } catch (Exception $e) { + } catch (Exception) { $this->_forward('noRoute'); } } @@ -176,7 +176,7 @@ public function downloadCustomOptionAction() try { $info = Mage::helper('core/unserializeArray')->unserialize($option->getValue()); $this->_downloadFileAction($info); - } catch (Exception $e) { + } catch (Exception) { $this->_forward('noRoute'); } exit(0); diff --git a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.1-0.8.2.php b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.1-0.8.2.php index ab9c0b8d2da..a47aef04c4f 100644 --- a/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.1-0.8.2.php +++ b/app/code/core/Mage/Sales/sql/sales_setup/mysql4-upgrade-0.8.1-0.8.2.php @@ -31,7 +31,7 @@ ALTER TABLE {$this->getTable('sales_quote_temp_decimal')} DROP COLUMN `store_id`, DROP INDEX `FK_sales_quote_temp_decimal_store`, DROP FOREIGN KEY `FK_sales_quote_temp_decimal_store`; ALTER TABLE {$this->getTable('sales_quote_temp_datetime')} DROP COLUMN `store_id`, DROP INDEX `FK_sales_quote_temp_datetime_store`, DROP FOREIGN KEY `FK_sales_quote_temp_datetime_store`; "); -} catch (Exception $e) { +} catch (Exception) { } $installer->installEntities(); diff --git a/app/code/core/Mage/Tag/controllers/CustomerController.php b/app/code/core/Mage/Tag/controllers/CustomerController.php index bd60f7011a7..24524065bef 100644 --- a/app/code/core/Mage/Tag/controllers/CustomerController.php +++ b/app/code/core/Mage/Tag/controllers/CustomerController.php @@ -110,7 +110,7 @@ public function removeAction() self::PARAM_NAME_URL_ENCODED => Mage::helper('core')->urlEncode(Mage::getUrl('customer/account/')), ])); return; - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('tag/session')->addError(Mage::helper('tag')->__('Unable to remove tag. Please, try again later.')); } } else { diff --git a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php index 9878ab26eab..22bc17c4c3a 100644 --- a/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php +++ b/app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php @@ -1631,7 +1631,7 @@ protected function _doShipmentRequestRest(Varien_Object $request): Varien_Object $rawJsonRequest = $this->_formShipmentRestRequest($request); try { $accessToken = $this->setAPIAccessRequest(); - } catch (Exception $e) { + } catch (Exception) { $result->setErrors(Mage::helper('usa')->__('Authentication error')); return $result; } diff --git a/app/code/core/Mage/Widget/Model/Widget.php b/app/code/core/Mage/Widget/Model/Widget.php index 66e69ea86e2..122a9a80834 100644 --- a/app/code/core/Mage/Widget/Model/Widget.php +++ b/app/code/core/Mage/Widget/Model/Widget.php @@ -156,7 +156,7 @@ public function getWidgetsXml($filters = []) throw new Exception(); } } - } catch (Exception $e) { + } catch (Exception) { unset($result->{$code}); continue; } diff --git a/app/code/core/Mage/Wishlist/Controller/Abstract.php b/app/code/core/Mage/Wishlist/Controller/Abstract.php index 3a9d5c2ab84..7f589f957c6 100644 --- a/app/code/core/Mage/Wishlist/Controller/Abstract.php +++ b/app/code/core/Mage/Wishlist/Controller/Abstract.php @@ -168,7 +168,7 @@ public function allcartAction() // save wishlist model for setting date of last update try { $wishlist->save(); - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('wishlist/session')->addError($this->__('Cannot update wishlist')); $redirectUrl = $indexUrl; } diff --git a/app/code/core/Mage/Wishlist/controllers/IndexController.php b/app/code/core/Mage/Wishlist/controllers/IndexController.php index 08465f13b2f..7a6d9357427 100644 --- a/app/code/core/Mage/Wishlist/controllers/IndexController.php +++ b/app/code/core/Mage/Wishlist/controllers/IndexController.php @@ -236,7 +236,7 @@ protected function _addItemToWishList() $session->addSuccess($message); } catch (Mage_Core_Exception $e) { $session->addError($this->__('An error occurred while adding item to wishlist: %s', $e->getMessage())); - } catch (Exception $e) { + } catch (Exception) { $session->addError($this->__('An error occurred while adding item to wishlist.')); } @@ -410,7 +410,7 @@ public function updateAction() // phpcs:ignore Ecg.Performance.Loop.ModelLSD ->save(); $updatedItems++; - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('customer/session')->addError( $this->__('Can\'t save description %s', Mage::helper('core')->escapeHtml($description)), ); @@ -422,7 +422,7 @@ public function updateAction() try { $wishlist->save(); Mage::helper('wishlist')->calculate(); - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('customer/session')->addError($this->__('Can\'t update wishlist')); } } @@ -463,7 +463,7 @@ public function removeAction() Mage::getSingleton('customer/session')->addError( $this->__('An error occurred while deleting the item from wishlist: %s', $e->getMessage()), ); - } catch (Exception $e) { + } catch (Exception) { Mage::getSingleton('customer/session')->addError( $this->__('An error occurred while deleting the item from wishlist.'), ); @@ -766,7 +766,7 @@ public function downloadCustomOptionAction() 'type' => 'filename', ]); } - } catch (Exception $e) { + } catch (Exception) { $this->_forward('noRoute'); } exit(0); diff --git a/lib/Mage/Xml/Generator.php b/lib/Mage/Xml/Generator.php index df6ff4f4055..2714286d1a2 100644 --- a/lib/Mage/Xml/Generator.php +++ b/lib/Mage/Xml/Generator.php @@ -56,7 +56,7 @@ public function arrayToXml($content) foreach ($content as $key => $item) { try { $node = $this->getDom()->createElement($key); - } catch (DOMException $e) { + } catch (DOMException) { // echo $e->getMessage(); var_dump($item); die; diff --git a/lib/Varien/Data/Form/Element/Date.php b/lib/Varien/Data/Form/Element/Date.php index 9e15728cdbe..cde6e6347df 100644 --- a/lib/Varien/Data/Form/Element/Date.php +++ b/lib/Varien/Data/Form/Element/Date.php @@ -97,7 +97,7 @@ public function setValue($value, $format = null, $locale = null) } try { $this->_value = new Zend_Date($value, $format, $locale); - } catch (Exception $e) { + } catch (Exception) { $this->_value = ''; } return $this; diff --git a/lib/Varien/Data/Tree/Db.php b/lib/Varien/Data/Tree/Db.php index 417d1b28f22..64028386a96 100644 --- a/lib/Varien/Data/Tree/Db.php +++ b/lib/Varien/Data/Tree/Db.php @@ -230,7 +230,7 @@ public function moveNodeTo($node, $parentNode, $prevNode = null) $this->_conn->update($this->_table, $dataReorderOld, $conditionReorderOld); $this->_updateChildLevels($node->getId(), $data[$this->_levelField]); $this->_conn->commit(); - } catch (Exception $e) { + } catch (Exception) { $this->_conn->rollBack(); throw new Exception('Can\'t move tree node'); } @@ -303,7 +303,7 @@ public function removeNode($node) // Update old node branch $this->_conn->update($this->_table, $dataReorderOld, $conditionReorderOld); $this->_conn->commit(); - } catch (Exception $e) { + } catch (Exception) { $this->_conn->rollBack(); throw new Exception('Can\'t remove tree node'); } diff --git a/lib/Varien/File/Uploader.php b/lib/Varien/File/Uploader.php index 4bba906e57d..ce75b4fc84f 100644 --- a/lib/Varien/File/Uploader.php +++ b/lib/Varien/File/Uploader.php @@ -373,7 +373,7 @@ public function checkMimeType($validTypes = []) return $validator->isValid($this->_file['tmp_name']); } return true; - } catch (Exception $e) { + } catch (Exception) { return false; } } diff --git a/lib/Varien/Image/Adapter/Gd2.php b/lib/Varien/Image/Adapter/Gd2.php index 493016e4d03..94fbb4070be 100644 --- a/lib/Varien/Image/Adapter/Gd2.php +++ b/lib/Varien/Image/Adapter/Gd2.php @@ -140,7 +140,7 @@ public function save($destination = null, $newName = null) try { $io = new Varien_Io_File(); $io->mkdir($destination); - } catch (Exception $e) { + } catch (Exception) { throw new Exception("Unable to write file into directory '{$destinationDir}'. Access forbidden."); } } @@ -268,7 +268,7 @@ private function _fillBackgroundColor(&$imageResourceTo) imagecolortransparent($imageResourceTo, $transparentColor); return $transparentColor; } - } catch (Exception $e) { + } catch (Exception) { // fallback to default background color } }