2013-08-29 52 views
0

我安裝了magento,我通過連接器安裝了ModuleCreator。 它安裝正常,但當我通過的mysite/moduleCreator訪問它,我登錄(如管理員),它給了我這個錯誤:Magento ModuleCreator錯誤

Fatal error: Uncaught exception 'Exception' with message 'Warning: array_key_exists() expects parameter 2 to be array, null given in /var/www/html/develop.scsprovider.com/ebp/calin/magento/app/code/core/Mage/Captcha/Model/Observer.php on line 166' in /var/www/html/develop.scsprovider.com/ebp/calin/magento/app/code/core/Mage/Core/functions.php:245 Stack trace: #0 [internal function]: mageCoreErrorHandler(2, 'array_key_exist...', '/var/www/html/d...', 166, Array) #1 /var/www/html/develop.scsprovider.com/ebp/calin/magento/app/code/core/Mage/Captcha/Model/Observer.php(166): array_key_exists('username', NULL) #2 /var/www/html/develop.scsprovider.com/ebp/calin/magento/app/code/core/Mage/Core/Model/App.php(1338): Mage_Captcha_Model_Observer->checkUserLoginBackend(Object(Varien_Event_Observer)) #3 /var/www/html/develop.scsprovider.com/ebp/calin/magento/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Captcha_Model_Observer), 'checkUserLoginB...', Object(Varien_Event_Observer)) #4 in /var/www/html/develop.scsprovider.com/ebp/calin/magento/app/code/core/Mage/Core/functions.php on line 245

回答

1

我發現有關於Magento的新版本中的問題和發現那位修復:

成功安裝後,去你favourate文件管理器 去路徑:

app/code/core/mage/captcha/model/observer.php

,改變

public function checkUserLoginBackend($observer) 
    { 
    $formId = 'backend_login'; 
      $captchaModel = Mage::helper('captcha')->getCaptcha($formId); 
      $loginParams = Mage::app()->getRequest()->getPost('login'); 
      $login = array_key_exists('username', $loginParams) ? $loginParams['username'] : null; 
      if ($captchaModel->isRequired($login)) { 
       if (!$captchaModel->isCorrect($this->_getCaptchaString(Mage::app()->getRequest(), $formId))) { 
        $captchaModel->logAttempt($login); 
        Mage::throwException(Mage::helper('captcha')->__('Incorrect CAPTCHA.')); 
       } 
      } 
      $captchaModel->logAttempt($login); 
      return $this; 
     } 

TO

public function checkUserLoginBackend($observer) 
    { 
     $formId = 'backend_login'; 
     $captchaModel = Mage::helper('captcha')->getCaptcha($formId); 

     $login = Mage::app()->getRequest()->getPost('username'); 
     if ($captchaModel->isRequired($login)) { 
      if (!$captchaModel->isCorrect($this->_getCaptchaString(Mage::app()->getRequest(), $formId))) { 
       $captchaModel->logAttempt($login); 
       Mage::throwException(Mage::helper('captcha')->__('Incorrect CAPTCHA.')); 
      } 


     } 
     $captchaModel->logAttempt($login); 
     return $this; 
    } 
+1

請勿編輯核心。當你這樣做的時候你正在問問題。如果您必須覆蓋核心功能,請創建一個模塊並覆蓋該文件。 – CarComp