未定义块变量的Magento错误

时间:2014-12-09 06:22:23

标签: magento

2014-12-09T06:16:53+00:00 ERR (3): Warning: Missing argument 1 for Mage_Core_Block_Abstract::insert()  in \app\code\core\Mage\Core\Block\Abstract.php on line 680
2014-12-09T06:16:53+00:00 ERR (3): Notice: Undefined variable: block  in \app\code\core\Mage\Core\Block\Abstract.php on line 682
2014-12-09T06:16:53+00:00 ERR (3): Notice: Undefined variable: block  in \app\code\core\Mage\Core\Block\Abstract.php on line 685

实际例外:

Warning: Missing argument 1 for Mage_Core_Block_Abstract::insert()  in C:\wamp\www\myproj\app\code\core\Mage\Core\Block\Abstract.php on line 680

#0 C:\wamp\www\myproj\app\code\core\Mage\Core\Block\Abstract.php(680): mageCoreErrorHandler(2, 'Missing argumen...', 'C:\wamp\www\myp...', 680, Array)
#1 [internal function]: Mage_Core_Block_Abstract->insert()
#2 C:\wamp\www\myproj\app\code\core\Mage\Core\Model\Layout.php(348): call_user_func_array(Array, Array)
#3 C:\wamp\www\myproj\app\code\core\Mage\Core\Model\Layout.php(214): Mage_Core_Model_Layout->_generateAction(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#4 C:\wamp\www\myproj\app\code\core\Mage\Core\Controller\Varien\Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#5 C:\wamp\www\myproj\app\code\core\Mage\Catalog\controllers\CategoryController.php(148): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#6 C:\wamp\www\myproj\app\code\core\Mage\Core\Controller\Varien\Action.php(418): Mage_Catalog_CategoryController->viewAction()
#7 C:\wamp\www\myproj\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('view')
#8 C:\wamp\www\myproj\app\code\core\Mage\Core\Controller\Varien\Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#9 C:\wamp\www\myproj\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#10 C:\wamp\www\myproj\app\Mage.php(684): Mage_Core_Model_App->run(Array)
#11 C:\wamp\www\myproj\index.php(90): Mage::run('', 'store')
#12 {main}

我从本地环境获得了上面列出的错误。它在开发服务器上运行良好。 任何人都可以帮助我,我面临的问题是什么。

我正在使用Magento 1.9.1 CE

我的管理员工作正常。后端没问题。

我可以在登录前查看我的前端。如果我登录然后它会给我所有页面,因为网页不可用。以上列出的错误记录在日志文件中。

我的Config.xml

<?xml version="1.0"?>
<!--
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    Mage
 * @package     Mage_Core
 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
-->
<config>
    <global>
        <install>
            <date/>
        </install>
        <resources>
            <default_setup>
                <connection>
                    <host>localhost</host>
                    <username/>
                    <password/>
                    <dbname>magento</dbname>
                    <model>mysql4</model>
                    <initStatements>SET NAMES utf8</initStatements>
                    <type>pdo_mysql</type>
                    <active>0</active>
                </connection>
            </default_setup>
            <default_write>
                <connection>
                    <use>default_setup</use>
                </connection>
            </default_write>
            <default_read>
                <connection>
                    <use>default_setup</use>
                </connection>
            </default_read>
            <core_setup>
                <setup>
                    <module>Mage_Core</module>
                </setup>
                <connection>
                    <use>default_setup</use>
                </connection>
            </core_setup>
            <core_write>
                <connection>
                    <use>default_write</use>
                </connection>
            </core_write>
            <core_read>
                <connection>
                    <use>default_read</use>
                </connection>
            </core_read>
        </resources>
        <resource>
            <connection>
                <types>
                    <pdo_mysql>
                        <adapter>Magento_Db_Adapter_Pdo_Mysql</adapter>
                        <class>Mage_Core_Model_Resource_Type_Db_Pdo_Mysql</class>
                        <compatibleMode>1</compatibleMode>
                    </pdo_mysql>
                </types>
            </connection>
        </resource>
        <models>
            <varien>
                <class>Varien</class>
            </varien>
            <core>
                <class>Mage_Core_Model</class>
                <resourceModel>core_resource</resourceModel>
            </core>
            <core_resource>
                <class>Mage_Core_Model_Resource</class>
                <deprecatedNode>core_mysql4</deprecatedNode>
                <entities>
                    <config_data>
                        <table>core_config_data</table>
                    </config_data>
                    <website>
                        <table>core_website</table>
                    </website>
                    <store>
                        <table>core_store</table>
                    </store>
                    <resource>
                        <table>core_resource</table>
                    </resource>
                    <cache>
                        <table>core_cache</table>
                    </cache>
                    <cache_tag>
                        <table>core_cache_tag</table>
                    </cache_tag>
                    <cache_option>
                        <table>core_cache_option</table>
                    </cache_option>
                </entities>
            </core_resource>
        </models>
    </global>
    <default>
        <system>
            <filesystem>
                <base>{{root_dir}}</base>
                <app>{{root_dir}}/app</app>
                <code>{{app_dir}}/code</code>
                <design>{{app_dir}}/design</design>
                <locale>{{app_dir}}/locale</locale>
                <etc>{{app_dir}}/etc</etc>
                <media>{{root_dir}}/media</media>
                <upload>{{root_dir}}/media/upload</upload>
                <skin>{{root_dir}}/skin</skin>
                <var>{{var_dir}}</var>
                <cache>{{var_dir}}/cache</cache>
                <session>{{var_dir}}/session</session>
                <tmp>{{var_dir}}/tmp</tmp>
                <pear>{{var_dir}}/pear</pear>
                <export>{{var_dir}}/export</export>
            </filesystem>
        </system>
        <general>
            <locale>
                <code>en_US</code>
                <timezone>America/Los_Angeles</timezone>
            </locale>
        </general>
    </default>
    <varien>
        <class>Varien</class>
    </varien>
</config>

1 个答案:

答案 0 :(得分:1)

好吧,如果你正确读取了堆栈跟踪,看起来你在布局句柄的某个地方有一个动作标签,它调用了他引用的块的插入方法,通常是这样的:

<reference name="someblock">
    <action method="insert">...</action>
</reference>

此方法插入应具有与(块名称)一起传递的参数。 在您的情况下,看起来没有传递参数。

您是否在当地环境中拥有自定义扩展程序? 您应该查看XML布局,如果一切正常,prod / local之间有变化吗?

也许你可以在_generateAction($ node,$ parent)(app / code / core / Mage / Core / Model / Layout.php)中进行一些调试,找出导致此错误的块然后找到问题!

祝你好运!