Ashwin Parmar
Ashwin Parmar

Reputation: 3045

Magento Error for undefined block variable

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

Actual Exception:

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}

I got above listed error from my local environment. It is working fine in development server. Can anyone help me what was the issue I am facing.

I am using Magento 1.9.1 CE

My Admin secition is working fine. no problem with backend.

I can view my front-end before login. If I logged in and then It will give me all pages as webpage is not available. and above listed error are logged in log files.

My 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 [email protected] 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>

Upvotes: 0

Views: 1648

Answers (1)

Jona
Jona

Reputation: 1156

Well if you read correctly the stacktrace, it seems that you have, somewhere in a layout handle, an action tag that calls the insert method of his referenced block, typicaly like this:

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

This method insert should have an argument passed with (block name). In your case it looks like there is no arguments passed.

Do you have a custom extension in your local environnement ? You should look into XML layouts if all is ok, there is a change between prod/local ?

Maybe you can do some debug in _generateAction($node, $parent) (app/code/core/Mage/Core/Model/Layout.php) to find out which block is causing this error and then find the problem !

Good luck !

Upvotes: 1

Related Questions