simplexml_load_string()

Asked

Viewed 256 times

3

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)) {
            continue;
        }
        $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) {
            continue;
        }
        $layoutStr .= $fileXml->innerXml();
    }
    $layoutXml = simplexml_load_string('<layouts>'.$layoutStr.'</layouts>', $elementClass);
    return $layoutXml;

Does anyone have any idea why it would just appear out of nowhere?

--

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

if (!is_readable($filename)) {
   continue;
}

Doing this all the files that were opened were logger on system.log. I noticed that right after a module ipgbasegratis.xml and ipgpagsegurogratis.xml be called the error appeared...exactly in the file ipgpagsegurogratis.xml.

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 mode at the end of the purchase, what else should contain after this xml snippet? note that the error is pointing to double quotes when displayed in the error log.

  • for some reason he is converting the characters "<" by "&lt;" which is how to use html not to interpret as a TAG. What’s in local.xml ? can post content?

  • Hiago, Voce refers to the local.xml theme?

  • This usually happens when the xml is not well formatted.

  • @rray I think I found the error, I put Mage::Log($filename, true)to list the files in the log and when the error appeared I saw it was after the file ipgpagsegurogratis.xml and when I open it appears the error in question that is "missing" some character but the same is correct in my view, what contains in it is: <?xml version="1.0"?>`

1 answer

1


As for the error may be occurring because the file does not have content only the xml declaration, try to put:

<?xml version="1.0"?>
<layout version="0.1.0">
<default></default>
</layout>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.