0

我安装了 magento,并通过连接器安装了 ModuleCreator。它安装得很好,但是当我通过 mysite/moduleCreator 访问它并登录(以管理员身份)时,它给了我这个错误:

致命错误:未捕获的异常“异常”,消息“警告:array_key_exists() 需要参数 2 为数组,/var/www/html/develop.scsprovider.com/ebp/calin/magento/app/code/core 中给出的 null /Mage/Captcha/Model/Observer.php 在 /var/www/html/develop.scsprovider.com/ebp/calin/magento/app/code/core/Mage/Core/functions.php:245 的第 166 行trace: #0 [内部函数]: 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 第 245 行

4

1 回答 1

1

我发现新版本的magento存在问题并找到了修复:

成功安装后转到您喜欢的文件管理器转到路径:

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;
        }

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;
    }
于 2013-08-29T12:09:18.873 回答