I got stuck on this error:
Warning: simplexml_load_string(): Entity: line 46: parser error : Comment not terminated in */lib/Varien/Simplexml/Config.php on line 510
and
Entity: line 46: parser error : Start tag expected, '<' not found in */lib/Varien/Simplexml/Config.php on line 510
It is clear that there is an issue in some Xml file, but really not easy for me to find out the needle in the big haystack :)
Any good practice for that? If possible I would like to find a good practice that involves use Xdebug, or some log.
It happens a lot of time in Magento to do some miss spelling.
Edit file app/code/core/Mage/Core/Model/Layout/Update.php and search for function "getFileLayoutUpdatesXml".
Add:
aproximately at line 442, before:
Well, after a good search, if the
$string
is all the CML merged, you have almost not chance to find what tag is bad closed.I found a way to do it, in the class /lib/Varien/Simplexml/Config.php you have to modify the next method:
In this way we now can see what file has a bad tag.
in
go and add a debug line and echo out the xml it tries to load and see what is wrong with this string.
If your test environment is Linux, you can also use XMLLint
xmllint
to check the layout xml file for inconsistencies after you've made changes to it. Checking before implementation discovers a multitude of sins and prevents having errors thrown.I think you can take a look at this article Dealing with XML errors.
This warning is related to some config.xml error, so a possible workaround to find out the exact file is to mod. the /lib/Varien/Simplexml/Config.php class.
You should modify
Varien_Simplexml_Config::loadString()
method:In case the error is related to some Layout file ( Update.php line 444 warning )
You should modify
Mage_Core_Model_Layout_Update::getFileLayoutUpdatesXml()
method in a similar way:Now just reload the page a read the error info.
To resolve that case, in same file */lib/Varien/Simplexml/Config.php on line#489
Print path of loaded XML file put
Zend_Debug::dump($filePath);
after$fileData = $this->processFileData($fileData);
and overwrite function loadString($string)
Replace with
And this will print the path and error where this create problem.