cancel
Showing results for 
Search instead for 
Did you mean: 

EE 1.14.2.0 + FPC + Minicart = Fatal Error in /Enterprise/PageCache/Model/Container/Minicart.php:41

EE 1.14.2.0 + FPC + Minicart = Fatal Error in /Enterprise/PageCache/Model/Container/Minicart.php:41

We have been getting this error every now and then:

PHP Fatal error: Uncaught Error: Call to a member function setSkipRenderTag() on boolean in .../app/code/core/Enterprise/PageCache/Model/Container/Minicart.php:41
Stack trace:
#0 .../app/code/core/Enterprise/PageCache/Model/Container/Abstract.php(104): Enterprise_PageCache_Model_Container_Minicart->_renderBlock()
#1 .../app/code/core/Enterprise/PageCache/controllers/RequestController.php(38): Enterprise_PageCache_Model_Container_Abstract->applyInApp('<!DOCTYPE html ...')
#2 .../app/code/core/Mage/Core/Controller/Varien/Action.php(418): Enterprise_PageCache_RequestController->processAction()
#3 .../app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Va in .../app/code/core/Enterprise/PageCache/Model/Container/Minicart.php on line 41

Method from Enterprise_PageCache_Model_Container_Minicart:

protected function _renderBlock()
{
    $layout = $this->_getLayout('default');
    $block = $layout->getBlock('minicart_head');
    $block->setSkipRenderTag(true);  // throws the exception
    return $block->toHtml();
}

This error was shown on a white page with that trace in plain text. We are not able to reproduce this fatal error, but it seems to be happening after FPC has not been refreshed for a while. It also seems isolated to certain users since the error is not displayed for everybody at the same time. For example, my colleague had the error while I did not. We also suspect that it may be happening to just logged in users, but we haven't been able to confirm that. Refreshing the FPC gets rid of the issue, but we have not been able to get to the cause of the issue.

 

We are on a custom theme and calling the minicart block in our header.phtml template by using:

<?php echo $this->getChildHtml('minicart_head'); ?>

 

In /template/checkout/cart/minicart.phtml, we are calling the minicart contents by using:

<?php echo $this->getChildHtml('minicart_content');?>

 

This is from /layout/checkout.xml for the minicart block:

<reference name="header">
    <block type="checkout/cart_minicart" name="minicart_head" template="checkout/cart/minicart.phtml" before="-">
        <block type="checkout/cart_sidebar" name="minicart_content" template="checkout/cart/minicart/items.phtml">
            <action method="addItemRender"><type>default</type><block>checkout/cart_item_renderer</block><template>checkout/cart/minicart/default.phtml</template></action>
            <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/minicart/default.phtml</template></action>
            <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/minicart/default.phtml</template></action>
            <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/minicart/default.phtml</template></action>
            <block type="core/text_list" name="cart_sidebar.cart_promotion" as="cart_promotion" translate="label" module="checkout">
                <label>Mini-cart promotion block</label>
            </block>
            <block type="core/text_list" name="cart_sidebar.extra_actions" as="extra_actions" translate="label" module="checkout">
                <label>Shopping Cart Sidebar Extra Actions</label>
            </block>
        </block>
    </block>
</reference>

 

And finally, this is for the hole punch in /app/code/core/Enterprise/PageCache/etc/cache.xml:

<minicart>
    <block>checkout/cart_minicart</block>
    <placeholder>MINICART</placeholder>
    <container>Enterprise_PageCache_Model_Container_Minicart</container>
    <cache_lifetime>86400</cache_lifetime>
</minicart>

 

For the time being, we have disabled minicart in hopes of not running into the fatal error while we are investigating this issue.

 

Has anybody come across this error before? Besides for setting up a cron job to refresh FPC every X hours, is there some other fix for this issue? Searching around on google didn't turn up any helpful results. We are on EE 1.14.2.0, using Enterprise_PageCache for FPC, and on PHP 7.0.15.