magento后端无法登录致命错误getBlockName [英] magento backend unable to login Fatal error getBlockName
问题描述
在Magento 1.8上运行
Running on Magento 1.8
我正在复制到测试生产站点,但是在后端我无法登录,这是错误消息.
I was copying to a test production site but at the backend I couldn't login and this is the error message.
Fatal error: Call to a member function getBlockName() on a non-object in /var/www/test/app/code/core/Mage/Captcha/Block/Captcha.php on line 43
为解决此问题,通常我们删除var/cache
文件夹,但是问题出在此测试站点上,我们没有var
文件夹,所以我不确定是什么引起了错误.
To solve this problem usually we delete var/cache
folder, but the problem is on this test site we don't have a var
folder so I'm not sure what is causing the error.
这是链接
推荐答案
看起来您的代码假定存在一个块类,并使用该类的实例,然后调用函数getBlockName()
.
It looks like your code assumes a block class exists and uses instance of that class and then calls a functions getBlockName()
.
class Mage_Captcha_Block_Captcha extends Mage_Core_Block_Template
{
/**
* Renders captcha HTML (if required)
*
* @return string
*/
protected function _toHtml()
{
$blockPath = Mage::helper('captcha')->getCaptcha($this->getFormId())->getBlockName();
是造成问题的代码.
如果您查看此行:getCaptcha($this->getFormId())
这应该已经返回了一个块实例,但是由于某种原因却没有.
this should have returned a block instance but for some reason it didn't.
因此,您需要检查Magento日志并调试getCaptcha($this->getFormId())
没有生成块的原因.
So you need to check your Magento logs and debug as to why getCaptcha($this->getFormId())
didn't generate a block.
这篇关于magento后端无法登录致命错误getBlockName的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!