2

System.log error

2016-02-04T03:16:25+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 9: parser error : Extra content at the end of the document  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-04T03:16:25+00:00 ERR (3): Warning: simplexml_load_string(): <reference name="left">  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-04T03:16:25+00:00 ERR (3): Warning: simplexml_load_string(): ^  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-04T04:00:17+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 9: parser error : Extra content at the end of the document  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-04T04:00:17+00:00 ERR (3): Warning: simplexml_load_string(): <reference name="left">  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450
2016-02-04T04:00:17+00:00 ERR (3): Warning: simplexml_load_string(): ^  in /var/www/html/magento/app/code/core/Mage/Core/Model/Layout/Update.php on line 450

this is my Update.php

 // custom local layout updates file - load always last
    $updateFiles[] = 'local.xml';
    $layoutStr = '';
    foreach ($updateFiles as $file) {
        $filename = $design->getLayoutFilename($file, array(
            '_area'    => $area,
            '_package' => $package,
            '_theme'   => $theme
        ));
        if (!is_readable($filename)) {
            continue;
        }
        $fileStr = file_get_contents($filename);
        $fileStr = str_replace($this->_subst['from'], $this->_subst['to'],$fileStr);
        $fileXml = simplexml_load_string($fileStr,$elementClass);
        if (!$fileXml instanceof SimpleXMLElement) {continue;}
        $layoutStr .=$fileXml->innerXml();
                                            Mage::log(print_r($filename, true));
    }
    $layoutXml = simplexml_load_string('<layouts>'.$layoutStr.'</layouts>',$elementClass);
    return $layoutXml;
}

}

  • It means there is some tag error or extra invalid content in recently changed xml configuration. – Rohit Kundale Feb 4 '16 at 4:59
4

The bug is not in Update.php but in your layout XML files. Conveniently, you or somebody else already added a line to debug: Mage::log(print_r($filename, true)); - if you move it 3 lines up, before the first simplexml_load_string(), you will get an additional line in system.log right before these errors that tells you which file it is. Remove the logging code afterwards!

From the error message, it is evident that you have added content to the end of a layout XML file, which results in invalid XML:

<?xml version="1.0"?>
<layout>
    ...
</layout>
<reference name="left">
^
|
this is where the parser fails

XML files must always have exactly one root element. Also, it would not make sense, to add layout instructions that are not within a layout handle. To add/change something in the left column on each page, your XML should look similar to this:

<?xml version="1.0"?>
<layout>       <!-- mandatory root element -->
    <default>  <!-- the handle -->
        <reference name="left">
            ...
        </reference>
    </default>
</layout>
  • You're the man @Fabian – Tahir Yasin Sep 16 '18 at 15:07
1

The error is an indication of xml tag mismatching that happend somwhere in your layout update xml files.

Just go and check those layout update xml files that you have recently edited and correct those mistakes.

1

There is some XML that has been added custom to either local.xml or some other xml (recent changes)

<reference name="left"></reference>

From the error, it says there is ADDITIONAL content at the end or beginning of this tag (some custom change). Check that.

This is causing the problem.

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.