When cleaning magento cache Opening and ending tag

2019-07-04 03:13发布

问题:

Entity: line 60: parser error : Opening and ending tag mismatch: config line 28 and confg  in /home/theprint/public_html/lib/Varien/Simplexml/Config.php

This exception happens when I try to clean the magento cache and I have enabled to print errors on my index.php, if I dont have this line on index.php, then it works fine

if ($_SERVER['REMOTE_ADDR'] == '83.134.115.xxx') { Mage::setIsDeveloperMode(true); ini_set('display_errors', 1); }


Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 60: parser error : Opening and ending tag mismatch: config line 28 and confg  in /home/theprint/public_html/lib/Varien/Simplexml/Config.php on line 510

#0 [internal function]: mageCoreErrorHandler(2, 'simplexml_load_...', '/home/theprint/...', 510, Array)
#1 /home/theprint/public_html/lib/Varien/Simplexml/Config.php(510): simplexml_load_string('loadString('loadFile('/home/theprint/...')
#4 /home/theprint/public_html/app/code/core/Mage/Admin/Model/Config.php(59): Mage_Core_Model_Config->loadModulesConfiguration('adminhtml.xml', Object(Varien_Simplexml_Config))
#5 /home/theprint/public_html/app/code/core/Mage/Core/Model/Config.php(1351): Mage_Admin_Model_Config->__construct(Array)
#6 /home/theprint/public_html/app/Mage.php(432): Mage_Core_Model_Config->getModelInstance('admin/config', Array)
#7 /home/theprint/public_html/app/Mage.php(446): Mage::getModel('admin/config', Array)
#8 /home/theprint/public_html/app/code/core/Mage/Adminhtml/Block/Page/Menu.php(124): Mage::getSingleton('admin/config')
#9 /home/theprint/public_html/app/code/core/Mage/Adminhtml/Block/Page/Menu.php(89): Mage_Adminhtml_Block_Page_Menu->_buildMenuArray()
#10 /home/theprint/public_html/app/design/adminhtml/default/default/template/page/menu.phtml(32): Mage_Adminhtml_Block_Page_Menu->getMenuArray()
#11 /home/theprint/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/theprint/...')
#12 /home/theprint/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#13 /home/theprint/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#14 /home/theprint/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#15 /home/theprint/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#16 /home/theprint/public_html/app/code/core/Mage/Core/Block/Abstract.php(582): Mage_Core_Block_Abstract->toHtml()
#17 /home/theprint/public_html/app/code/core/Mage/Core/Block/Abstract.php(526): Mage_Core_Block_Abstract->_getChildHtml('menu', true)
#18 /home/theprint/public_html/app/design/adminhtml/default/default/template/page.phtml(53): Mage_Core_Block_Abstract->getChildHtml('menu')
#19 /home/theprint/public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/theprint/...')
#20 /home/theprint/public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('adminhtml/defau...')
#21 /home/theprint/public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#22 /home/theprint/public_html/app/code/core/Mage/Adminhtml/Block/Template.php(81): Mage_Core_Block_Template->_toHtml()
#23 /home/theprint/public_html/app/code/core/Mage/Core/Block/Abstract.php(863): Mage_Adminhtml_Block_Template->_toHtml()
#24 /home/theprint/public_html/app/code/core/Mage/Core/Model/Layout.php(529): Mage_Core_Block_Abstract->toHtml()
#25 /home/theprint/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(391): Mage_Core_Model_Layout->getOutput()
#26 /home/theprint/public_html/app/code/core/Mage/Adminhtml/controllers/CacheController.php(48): Mage_Core_Controller_Varien_Action->renderLayout()
#27 /home/theprint/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(420): Mage_Adminhtml_CacheController->indexAction()
#28 /home/theprint/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#29 /home/theprint/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#30 /home/theprint/public_html/app/code/core/Mage/Core/Model/App.php(347): Mage_Core_Controller_Varien_Front->dispatch()
#31 /home/theprint/public_html/app/Mage.php(640): Mage_Core_Model_App->run(Array)
#32 /home/theprint/public_html/www.theprinterdepo.com/index.php(55): Mage::run('printerdepo', 'website')
#33 {main}

回答1:

One of the adminhtml.xml module configuration files in your installation contains invalid XML. If you can't figure out which one it is, go to line `5101 in

/home/theprint/public_html/lib/Varien/Simplexml/Config.php

and add some debugging code around the call to simplexml_load_string such that PHP var_dumps the full path. That should point you to the non well formed XML file.



回答2:

Change public function loadString($string) as the following. Check the line numer 510

public function loadString($string)

{
    if (is_string($string)) {
        // Enable internal errors
        libxml_use_internal_errors(true);
        $xml = simplexml_load_string($string, $this->_elementClass);
        if (false === $xml) {
            // Put breakpoint here
            $errors = libxml_get_errors();
        }
        if ($xml instanceof Varien_Simplexml_Element) {
            $this->_xml = $xml;
            return true;
        }
    } else {
        Mage::logException(new Exception('"$string" parameter for simplexml_load_string is not a string'));
    }
    return false;
}