0

What does this error mean and how can I fix it? I'm sure it is related to me upgrading to php7. Thanks

Error:

PHP Fatal error:  Uncaught TypeError: Argument 1 passed to Mage_Adminhtml_Controller_Action::_addLeft() must be an instance of Mage_Core_Block_Abstract, boolean given, called in controllers/Adminhtml/ListController.php on line 29 and defined in Mage/Adminhtml/Controller/Action.php:63

From ListController.php:

        public function editAction()
        {
            $id     = $this->getRequest()->getParam('id');
            $model  = Mage::getModel('commentbox/comment')->load($id);
            if ($model->getId() || $id == 0)
            {
                $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
                if (!empty($data))
                    $model->setData($data);

                Mage::register('comment_data', $model);
                $this->loadLayout();
                $this->_setActiveMenu('system/commentbox');
                $this->_addContent($this->getLayout()->createBlock('commentbox/adminhtml_list_edit'))
  line 29-->         ->_addLeft($this->getLayout()->createBlock('commentbox/adminhtml_list_edit_tabs'));
                $this->renderLayout();
            }
            else
            {
                Mage::getSingleton('adminhtml/session')->addError(Mage::helper('commentbox')->__('Specified Script was not found!'));
                $this->_redirect('*/*/');
            }
        }

From Action.php:

line 63-->   protected function _addLeft(Mage_Core_Block_Abstract $block)
    {
        $this->getLayout()->getBlock('left')->append($block);
        return $this;
    }
6
  • are you sure the class with alias "commentbox/adminhtml_list_edit_tabs" exists?
    – Marius
    Commented Jul 28, 2016 at 12:54
  • Not sure if I have the class. How can I find out? I have this folder structure: Block/Adminhtml/List/Edit/Form.php
    – Freejoy
    Commented Jul 28, 2016 at 13:08
  • Do you have the file [Namespace]/[Module]/Block/Adminhtml/List/Edit/Tabs.php
    – Marius
    Commented Jul 28, 2016 at 13:18
  • No I don't. Strange. It use to work.
    – Freejoy
    Commented Jul 28, 2016 at 13:22
  • Firstly, Magento 1.x doesn't support PHP7 so you're probably wasting your time
    – scrowler
    Commented Jul 29, 2016 at 11:47

1 Answer 1

0

Based on the comments...
The error appears because the block invoked [Namespace]/[Module]/Block/Adminhtml/List/Edit/Tabs.php does not exist.
In this case the createBlock method returns false and the _addLeft method gives an error because it expects an object as parameter not a boolean value.

1
  • Yeah, I couldn't fix that. So I deleted it. Thanks
    – Freejoy
    Commented Jul 29, 2016 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.