php – magento simplexml_load_string()


I was adding products to my store normally until the images stopped appearing on the front and when I went to see the error log what appeared was:

2015-10-28T11:40:00+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found  in /home/espacoor/public_html/app/code/core/Mage/Core/Model/Layout/Update.php on line 444
2015-10-28T11:40:00+00:00 ERR (3): Warning: simplexml_load_string(): <?xml version="1.0"?>  in /home/espacoor/public_html/app/code/core/Mage/Core/Model/Layout/Update.php on line 444
2015-10-28T11:40:00+00:00 ERR (3): Warning: simplexml_load_string():                      ^  in /home/espacoor/public_html/app/code/core/Mage/Core/Model/Layout/Update.php on line 444

Below the code to the file between line 430 to 451

// 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)) {
        $fileStr = file_get_contents($filename);
        $fileStr = str_replace($this->_subst['from'], $this->_subst['to'], $fileStr);
        $fileXml = simplexml_load_string($fileStr, $elementClass); //Linha 444
        if (!$fileXml instanceof SimpleXMLElement) {
        $layoutStr .= $fileXml->innerXml();
    $layoutXml = simplexml_load_string('<layouts>'.$layoutStr.'</layouts>', $elementClass);
    return $layoutXml;

Does anyone have any idea why this appears like this out of nowhere?

I was able to find the error using the following code; Mage::Log($filename, true); right after the

if (!is_readable($filename)) {

By doing this, all files that were opened were recorded in system.log . I noticed that right after a module ipgbasegratis.xml and ipgpagsegurogratis.xml were called, the error appeared… exactly in the ipgpagsegurogratis.xml file.

Erro no processamento de XML: nenhum elemento encontrado
Posição: file:///tmp/fz3temp-1/ipgpagsegurogratis.xml

Número da linha 1, coluna 22:<?xml version="1.0"?>

This file is responsible for displaying the payment method at the end of the purchase, what else should it contain after this xml excerpt? note that the error is pointing to the double quotes when it appears in the error log.


As for the error, it may be due to the file not having content only the xml declaration, try to put:

<?xml version="1.0"?>
<layout version="0.1.0">
Scroll to Top