谷歌索引Magento网站在action.php文件上有致命错误消息


Google Index Magento Website has Fatal Error Message on action.php file

谷歌已经能够爬到我的网站,但它无法索引任何内容。

当我以谷歌的身份访问我的网站时,我收到一条错误消息:

致命错误:在第497行的/var/www/magento/app/code/core/mage/core/controller/varian/action.php中对非对象调用成员函数getcookieshouldbereceived()

然后我打开action.php文件,看看有什么问题。在文件action.php中,第497行是这样的:

if($session->getCookieShouldBeReceived()){

包含第497行的段落是:/***检索操作方法名称**@param string$action*@return字符串*/公共函数getActionMethodName($action){return$action。'行动;}

/**
 * Dispatch event before action
 *
 * @return void
 */
public function preDispatch()
{
    if (!$this->getFlag('', self::FLAG_NO_CHECK_INSTALLATION)) {
        if (!Mage::isInstalled()) {
            $this->setFlag('', self::FLAG_NO_DISPATCH, true);
            $this->_redirect('install');
            return;
        }
    }
    // Prohibit disabled store actions
    if (Mage::isInstalled() && !Mage::app()->getStore()->getIsActive()) {
        Mage::app()->throwStoreException();
    }
    if ($this->_rewrite()) {
        return;
    }
    if (!$this->getFlag('', self::FLAG_NO_START_SESSION)) {
        $checkCookie = in_array($this->getRequest()->getActionName(), $this->_cookieCheckActions)
            && !$this->getRequest()->getParam('nocookie', false);
        $cookies = Mage::getSingleton('core/cookie')->get();
        /** @var $session Mage_Core_Model_Session */
        $session = Mage::getSingleton('core/session', array('name' => $this->_sessionNamespace))->start();
        if (empty($cookies)) {
            if ($session->getCookieShouldBeReceived()) {
                $this->setFlag('', self::FLAG_NO_COOKIES_REDIRECT, true);
                $session->unsCookieShouldBeReceived();
                $session->setSkipSessionIdFlag(true);
            } elseif ($checkCookie) {
                if (isset($_GET[$session->getSessionIdQueryParam()]) && Mage::app()->getUseSessionInUrl()
                    && $this->_sessionNamespace != Mage_Adminhtml_Controller_Action::SESSION_NAMESPACE
                ) {
                    $session->setCookieShouldBeReceived(true);
                } else {
                    $this->setFlag('', self::FLAG_NO_COOKIES_REDIRECT, true);
                }
            }
        }

你能帮我弄清楚出了什么问题吗?

谢谢!!

我也遇到了同样的问题。我认为当机器人访问网站时,$session对象为NULL,而不是像普通浏览器那样做出反应。我修改了;

if ($session->getCookieShouldBeReceived()) {

if (is_object($session) && $session->getCookieShouldBeReceived()) {

我的问题解决了。谷歌正常索引我的网站。我知道,修改核心代码不是一件好事,但我对magento很陌生。有人知道如何在不更改核心代码的情况下进行更改吗?