0

Refreshing cache from back end

Fatal error: Call to a member function asArray() on boolean in /home/bulkpowd/public_html/app/code/core/Mage/Core/Model/Layout/Update.php on line 420

When I open this file below code is written:

public function getFileLayoutUpdatesXml($area, $package, $theme, $storeId = null)
    {
        if (null === $storeId) {
            $storeId = Mage::app()->getStore()->getId();
        }
        /* @var $design Mage_Core_Model_Design_Package */
        $design = Mage::getSingleton('core/design_package');
        $layoutXml = null;
        $elementClass = $this->getElementClass();
        $updatesRoot = Mage::app()->getConfig()->getNode($area.'/layout/updates');
        Mage::dispatchEvent('core_layout_update_updates_get_after', array('updates' => $updatesRoot));
        $updates = $updatesRoot->asArray();   // line no. 420 this line produce error

This error is happened not every time but occurs sometimes, but I don't know the exact case when it comes.

How can I resolve it?

3
  • this indicates that magento config object unable to get frontend/layout/updates node , you can try to debug it with echo Mage::app()->getConfig()->getNode('frontend/layout')->asNiceXml(); exit; (or adminhtml/layout depending on where you are) to see which node is fails to load
    – Ilja
    Commented Jan 10, 2017 at 10:12
  • But this error is not coming everytime. It comes once in a day or later.
    – Shashank
    Commented Jan 10, 2017 at 10:39
  • When I tried above code with 'frontend/layout' its showed error Fatal error: Call to undefined method Mage_Core_Model_Config_Element::asNice‌​Xml(), while worked with 'adminhtml/layout' and showed all xml files.
    – Shashank
    Commented Jan 10, 2017 at 10:43

2 Answers 2

2

I had something similar a long ago, and it was because of the php version.
At that time I had PHP version 5.3.10-1ubuntu3.4 and, from time to time, as you say, the conversion from SimpleXMLElement to array returned nothing.
It looks to me like the same thing but not sure about it.
Some related but not really info can be found on SO.
So I advice you to check your PHP version, try and upgrade or a downgrade to see if this reproduces.

2
  • Is there any other way to resolve it because I can't upgrade php version on client sever. any other way means like doing some code hack in same file or something else ?
    – Shashank
    Commented Jan 10, 2017 at 11:23
  • First of all, I don't know if this is the problem for you. I just added the answer here because it smelled like the problem I had a while back. Check the php version and if it's the same as the one I mentioned then for sure you need an upgrade. If it's different, I don't have any other ideas.
    – Marius
    Commented Jan 10, 2017 at 12:09
0

Check your XMLs, maybe incorrect XML.

Also check logs, Magento logs & Apache/Nginx PHP

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.