Fatal Error Output in Footer when LiteMage is Enabled

The user is running a Magento 1.9.3.6 store with Meigee's Feather theme. As soon as LiteMage is enabled, a “Fatal Error” message appears in the header and footer.

At the top of the homepage, it shows:

Fatal error: Uncaught Error: Call to undefined method Litespeed_Litemage_Model_EsiLayout::getMConfigResultByAlias() in 
/home/yourdomain/public_html/app/design/frontend/feather/locker/template/checkout/cart/topcart.phtml:12 Stack trace: #0 
/home/yourdomain/public_html/app/code/core/Mage/Core/Block/Template.php(241): include() #1 
/home/yourdomain/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template-
>fetchView('frontend/feathe...') #2 /home/yourdomain/public_html/app/code/core/Mage/Core/Block/Template.php(286): 
Mage_Core_Block_Template->renderView() #3 /home/yourdomain/public_html/app/code/core/Mage/Core/Block/Abstract.php(923): 
Mage_Core_Block_Template->_toHtml() #4 
/home/yourdomain/public_html/app/code/community/Litespeed/Litemage/controllers/EsiController.php(217): Mage_Core_Block_Abstract-
>toHtml() #5 /home/yourdomain/public_html/app/code/community/Litespeed/Litemage/controllers/EsiController.php(436): 
Litespeed_Litemage_EsiController->_renderEsiBlock(Object(Litespeed_Litemage_Model_EsiDa in 
/home/yourdomain/public_html/app/design/frontend/feather/locker/template/checkout/cart/topcart.phtml on line 12

At the bottom of the homepage, it shows:

THERE HAS BEEN AN ERROR PROCESSING YOUR REQUEST
Exception printing is disabled by default for security reasons.
Error log record number: 600210582390

The error report shows:

a:5:{i:0;s:56:"Invalid method Mage_Page_Block_Html_Footer::(Array
(
)
)";i:1;s:2050:"#0 /home/yourdomain/public_html/app/code/core/Mage/Core/Model/Layout.php(348): Varien_Object->__call('', Array)
#1 /home/yourdomain/public_html/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))
#2 /home/yourdomain/public_html/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout-
>generateBlocks(Object(Mage_Core_Model_Layout_Element))
#3 /home/yourdomain/public_html/app/code/community/Litespeed/Litemage/Model/EsiLayout.php(68): Mage_Core_Model_Layout-
>generateBlocks()
#4 /home/yourdomain/public_html/app/code/community/Litespeed/Litemage/controllers/EsiController.php(435): 
Litespeed_Litemage_Model_EsiLayout->loadEsiLayout(Object(Litespeed_Litemage_Model_EsiData))
#5 /home/yourdomain/public_html/app/code/community/Litespeed/Litemage/controllers/EsiController.php(399): 
Litespeed_Litemage_EsiController->_processLayout(Array)
#6 /home/yourdomain/public_html/app/code/community/Litespeed/Litemage/controllers/EsiController.php(150): 
Litespeed_Litemage_EsiController->_processScheduled()
#7 /home/yourdomain/public_html/app/code/community/Litespeed/Litemage/controllers/EsiController.php(136): 
Litespeed_Litemage_EsiController->_getSingle()
#8 /home/yourdomain/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Litespeed_Litemage_EsiController-
>getBlockAction()
#9 /home/yourdomain/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): 
Mage_Core_Controller_Varien_Action->dispatch('getBlock')
#10 /home/yourdomain/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): 
Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#11 /home/yourdomain/public_html/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#12 /home/yourdomain/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#13 /home/yourdomain/public_html/index.php(89): Mage::run('', 'store')
#14 {main}";s:3:"url";s:1:"/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}

All of this is a signal that some of the themes/plugins/modules may be conflicting with the LiteSpeed module. You can choose LiteMage Level 3 Support to analyze your theme's code, locate the problematic section and fix it (LiteMage Premium support is fully refundable if we fail to enable LiteMage cache for your site) or you can engage a third-party experienced Magento developer for troubleshooting. If you are an experienced Magento developer yourself, this wiki will show you the basic troubleshooting steps involved in locating the problematic section of code and fixing it.

First of all, you will need to enable LiteMage's debug log to check the details. This is not Magento's system.log (which is controlled by System > Advanced > Developer > Log Settings > Enabled). That one you should leave as is. Instead, we are referring to a separate litemage.log file (which is controlled by LiteMage settings):

Enable Debug Log should be Yes Debug Level should be 9 Disable Layout Override for Non-Cacheable Routes should be yes

Once the above is properly configures, then you can check var/log/litemage.log for the error details.

From the error message, it seems the footer ESI may be the problem. We will try to disable LiteMage footer ESI and see if that helps.

cd app/code/community/Litespeed/Litemage/etc/
cp -p config.xml config.xml.bak1
vi config.xml

Scroll to the <esiblock> section and comment out the footer section:

              <!-- public blocks -->
                  <!-- Some themes will use a variable in footer that is declared in the header,
              this causes the footer block to fail to generate. You can modify the
              template to generate the missing variable or simply choose to not punch
              a hole in footer (comment out the footer block).
              Making the footer a public block will speed up page generation and save some disk space  -->
              <!-- footer>
                  <access>public</access>
                  <blocks>footer</blocks>
              </footer -->

Save the file and refresh the config in Magento Admin: navigate to Magento Admin > System > Cache Management, tick Configuration and Layouts to refresh.

Unfortunately, disabling the LiteMage footer ESI doesn't fix the issue.

Errors are caused by a class rewrite conflict with LiteMage.

Both LiteMage class Litespeed_Litemage_Model_EsiLayout and Meigee ThemeManager class Meigee_Thememanager_Rewrite_Core_Layout will override Mage_Core_Model_Layout.

In app/code/local/Meigee/Thememanager/etc/config.xml:

          <core>
              <rewrite>
                  <layout>Meigee_Thememanager_Rewrite_Core_Layout</layout>  <!-- Mage_Core_Model_Layout -->
              </rewrite>
          </core>

We see there is an error from topcart.phtml as it called an undefined function getMConfigResultByAlias.

vi app/design/frontend/feather/locker/template/checkout/cart/topcart.phtml
$meigeeOptions = $this->getLayout();
$catalogModeWrapper = $meigeeOptions->getMConfigResultByAlias('catalog_mode');
$catalogMode = $catalogModeWrapper['value']['sv2']['value'];

Find out the value of $catalogMode, and replace the variable with the actual value. This will make the configuration change invalid, which means you will also need to manually update here.

Now the new file will look like this:

/* commented out due to conflict with LiteMage *
* $meigeeOptions = $this->getLayout();
* $catalogModeWrapper = $meigeeOptions->getMConfigResultByAlias('catalog_mode');
* $catalogMode = $catalogModeWrapper['value']['sv2']['value']; */
$catalogMode = 0; // use the value directly

This seems to fix the problem, but we need to run more testing just to be sure.

After adding an item to cart, and refreshing, the page goes blank. View html source, and you can see the Fatal Error output:

<b>Fatal error</b>: Uncaught Error: Call to undefined method Litespeed_Litemage_Model_EsiLayout::checkVersion() in /home/yourdomain/public_html/app/design/frontend/feather/default/template/checkout/cart/sidebar/default.phtml:17
Stack trace:
#0 /home/yourdomain/public_html/app/code/core/Mage/Core/Block/Template.php(241): include()
#1 /home/yourdomain/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template-&gt;fetchView('frontend/feathe...')
#2 /home/yourdomain/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template-&gt;renderView()
#3 /home/yourdomain/public_html/app/code/core/Mage/Core/Block/Abstract.php(923): Mage_Core_Block_Template-&gt;_toHtml()
#4 /home/yourdomain/public_html/app/code/core/Mage/Checkout/Block/Cart/Abstract.php(174): Mage_Core_Block_Abstract-&gt;toHtml()
#5 /home/yourdomain/public_html/app/design/frontend/feather/locker/template/checkout/cart/topcart.phtml(38): Mage_Checkout_Block_Cart_Abstract-&gt;getItemHtml(Object(Mage_Sales_Model_Quote_Item))
#6 /home/yourlocke in <b>/home/yourdomain/public_html/app/design/frontend/feather/default/template/checkout/cart/sidebar/default.phtml</b> on line  <b>17</b><br />
<!--Litemage esi ended cart_sidebar-->   

Go to app/design/frontend/feather/default/template/checkout/cart/sidebar/default.phtml and edit it in vi.

There are multiple places showing

Mage::app()→getLayout()→checkVersion('1.7.x.x') ? $this→htmlEscape : $this→escapeHtml

The code app/code/local/Meigee/Thememanager/Rewrite/Core/Layout.php is just checking if Magento version is 1.7.x. We know the current store is 1.9.3, so this check will always be false.

Replace it with

$this->escapeHtml

We have disabled footer ESI in LiteMage in the first step, but we have further investigation on footer code. It has similar issue.

app/design/frontend/feather/default/template/page/html/footer.phtml

It uses the following line:

<?php echo $this->getLayout()->getMConfigResultByAlias('custom_footer_block'); ?>

Instead of calling function getMConfigResultByAlias, the user can put actual content there to avoid such issue. Since it has been covered by disabling LiteMage footer ESI, we don't change it here anymore.

Problem solved. Basically, the steps are to locate the problematic code in the Meigee Feather theme and fix it.

  • Admin
  • Last modified: 2018/01/12 22:16
  • by Jackson Zhang