1

Megamenu error After Upgrade Magento 2.3.2

Fatal error: Uncaught TypeError: Argument 4 passed to Ibnab\MegaMenu\Block\Html\Topmega::_getHtml() must be of the type array, null given

app\code\Ibnab\MegaMenu\Block\Html\Topmega.php on line 169
Ibnab\MegaMenu\Block\Html\Topmega->_getHtml(Object(Magento\Framework\Data\Tree\Node), 'submenu', 0, NULL)
Ibnab\MegaMenu\Block\Html\Topmega->_addSubMenu2(Object(Magento\Framework\Data\Tree\Node), 0, 'submenu', 0) 
Ibnab\MegaMenu\Block\Html\Topmega->_getHtml2(Object(Magento\Framework\Data\Tree\Node), 'submenu', 0) 
3

Edit following class and replace following code:

Ibnab\MegaMenu\Block\Html\Topmega

protected function _getHtml(
    \Magento\Framework\Data\Tree\Node $menuTree,
    $childrenWrapClass,
    $limit,
    array $colBrakes = []
) {
7
  • after above change Fatal error: Uncaught TypeError: Argument 4 passed to Ibnab\MegaMenu\Block\Html\Topmega::_getHtml() must be of the type array, null given
    – manoj pal
    Jul 4 '19 at 10:02
  • After applied my answer, you should check from where called this method. Passes third parameter to array except null.
    – Sohel Rana
    Jul 4 '19 at 10:27
  • $this->_getHtml($menuTree, 'submenu', 0, NULL) will replace $this->_getHtml($menuTree, 'submenu', 0, [])
    – Sohel Rana
    Jul 4 '19 at 10:41
  • sorry ,it's not working :)
    – manoj pal
    Jul 4 '19 at 11:39
  • Not sure how you test. Your 4th param should be an array but when you call you pass null data. So replace null by array.
    – Sohel Rana
    Jul 4 '19 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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