bestit / amazon-pay-oxid

Amazon Pay & Login for OXID eShop

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception thrown when deactivating the module

ulrich-berkmueller opened this issue · comments

When deactivating the module (v2.5.1) in OXID eShop 4.10 an exception (oxSystemComponentException) is thrown in bestitAmazonPay4Oxid_oxViewConfig::getSelfLink() when calling $this->_getContainer().

I don't know if this issue is still relevant in OXID eShop 6.0.

A quick fix that worked for me was:

--- a/modules/bestit/amazonpay4oxid/ext/bestitamazonpay4oxid_oxviewconfig.php
+++ b/modules/bestit/amazonpay4oxid/ext/bestitamazonpay4oxid_oxviewconfig.php
@@ -127,6 +127,14 @@ class bestitAmazonPay4Oxid_oxViewConfig extends bestitAmazonPay4Oxid_oxViewConfi
      */
     public function getSelfLink()
     {
+        // quick fix (when module was deactivated before within the same request)
+        try {
+            $this->_getContainer();
+        }
+        catch (oxSystemComponentException $ex) {
+            return parent::getSelfLink();
+        }
+
         if ((bool)$this->_getContainer()->getConfig()->getConfigParam('sSSLShopURL') === true
             && !$this->isAdmin()
             && $this->getAmazonLoginIsActive()

Excerpt from EXCEPTION_LOG.txt:

oxSystemComponentException-oxException (time: 2018-02-07 21:50:04): [0]: EXCEPTION_SYSTEMCOMPONENT_CLASSNOTFOUND 
 Stack Trace: #0 <SHOP_BASE_DIR>\core\oxutilsobject.php(188): oxUtilsObject->_getObject('oxsystemcompone...', 0, Array)
#1 [internal function]: oxUtilsObject->oxNew('oxSystemCompone...')
#2 <SHOP_BASE_DIR>\core\oxfunctions.php(368): call_user_func_array(Array, Array)
#3 <SHOP_BASE_DIR>\core\oxutilsobject.php(178): oxNew('oxSystemCompone...')
#4 [internal function]: oxUtilsObject->oxNew('bestitAmazonPay...')
#5 <SHOP_BASE_DIR>\core\oxfunctions.php(368): call_user_func_array(Array, Array)
#6 <SHOP_BASE_DIR>\modules\bestit\amazonpay4oxid\ext\bestitamazonpay4oxid_oxviewconfig.php(42): oxNew('bestitAmazonPay...')
#7 <SHOP_BASE_DIR>\modules\bestit\amazonpay4oxid\ext\bestitamazonpay4oxid_oxviewconfig.php(132): bestitAmazonPay4Oxid_oxViewConfig->_getContainer()
#8 <SHOP_BASE_DIR>\tmp\smarty\2338d2425adbff76c2c2807c150f6147^%%16^161^161A2516%%module_main.tpl.php(102): bestitAmazonPay4Oxid_oxViewConfig->getSelfLink()
#9 <SHOP_BASE_DIR>\core\smarty\Smarty.class.php(1264): include('...')
#10 <SHOP_BASE_DIR>\core\oxshopcontrol.php(519): Smarty->fetch('module_main.tpl', 'tbclmodule_main')
#11 <SHOP_BASE_DIR>\core\oxshopcontrol.php(364): oxShopControl->_render(Object(Module_Main))
#12 <SHOP_BASE_DIR>\core\oxshopcontrol.php(126): oxShopControl->_process('module_main', 'deactivateModul...', NULL, NULL)
#13 <SHOP_BASE_DIR>\core\oxid.php(40): oxShopControl->start()
#14 <SHOP_BASE_DIR>\index.php(26): Oxid::run()
#15 <SHOP_BASE_DIR>\admin\index.php(27): require_once('...')
#16 {main}

 Faulty component --> bestitamazonpay4oxidcontainer
---------------------------------------------

Thanks for the report, will be fixed with the next version.