SimpleXmlElement Parsing Errors

Just had a WordPress site updated with the latest Custom Contact Forms. After the update the site is no longer loading and I see these errors:

[27-Jun-2015 06:01:05 UTC] PHP Warning:  SimpleXMLElement::__construct(): Entity: line 130: parser error : Opening and ending tag mismatch: wphead line 1 and script in /storage/web/public/sites/www.site.nl/wp-content/themes/site/vihv/control/TControl.php on line 91
[27-Jun-2015 06:01:05 UTC] PHP Warning:  SimpleXMLElement::__construct(): </script> in /storage/web/public/sites/www.site.nl/wp-content/themes/site/vihv/control/TControl.php on line 91
[27-Jun-2015 06:01:05 UTC] PHP Warning:  SimpleXMLElement::__construct():          ^ in /storage/web/public/sites/www.site.nl/wp-content/themes/site/vihv/control/TControl.php on line 91
[27-Jun-2015 06:01:05 UTC] PHP Warning:  SimpleXMLElement::__construct(): Entity: line 148: parser error : Sequence ']]>' not allowed in content in /storage/web/public/sites/www.site.nl/wp-content/themes/site/vihv/control/TControl.php on line 91

The first error refers to this function:

function GetXml() {
            try {
                $Xml = new SimpleXmlElement(TXml::MakeTree($this->GetData(), get_class($this)));
                return $Xml->asXml();
            } catch(Exception $e) {
                //print_r($this->GetData());
            }
        return "<".get_class($this)."/>";
        }

But these errors are only PHP warnings, not fatal errors. But I get the white screen of death anyways.

I am not familiar with XML and XML parsing. Theme was created by third party developer and have not been able to contact him as of yet. It has been a while since this theme has been created.
I did uncomment the print_r to see what would show and all was printed and the first array showing up was:

Array ( [THeadControl] => Array ( [wphead] => ]]> [template_url] => http://www.site.nl/wp-content/themes/site [title] => ) [TLeftBlockContainer] => Array ( [THeaderControl] => Array ( [siteurl] => http://www.site.nl [siteTitle] => VERLOSKUNDIGENPRAKTIJK site [headpic] => http://www.site.nl/wp-content/uploads/2015/02/siteheader2.jpg [logoPhone] => http://www.site.nl/wp-content/themes/site/img/logo-phone.png ) [TSimpleMenuControl] => Array ( [menu] =>

And on line 130 I saw

<script type='text/javascript' src='http://www.site.nl/wp-includes/js/underscore.min.js?ver=1.6.0'></script>

I suspect that the plugin adds something to the header that causes the html tag errors / creating invalid XML.

Update
__construct() method addition here as suggested by @danbahrami

function __construct() {
        $Manager = TEventManager::getInstance();
        $Manager->AddListener($this);
        $this->SetEvent('OnGet', array($this,'OnGetEvent'));
        $this->SetEvent('OnPost', array($this,'OnPostEvent'));
        $this->SetEvent('OnDisplay', array($this,'OnDisplayEvent'));
        $this->SetEvent('OnBeforeDisplay', array($this,'OnBeforeDisplayEvent'));
        $this->SetEvent('OnEnable', array($this,'OnEnableEvent'));
        $this->SetEvent('OnDisable', array($this,'OnDisableEvent'));
        $this->SetEvent('OnCreate', array($this,'OnCreateEvent'));
        $this->SetEvent('OnRootTemplateLoad', array($this,'OnRootTemplateLoadEvent'));
        $this->SetEvent('OnDefaultPage', array($this,'OnDefaultPageEvent'));
        $this->OnCreate($this);
        }

The whole file TControl.php can be seen here. How can I debug this error? is it possible to bypass the errors?


Source: xml

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.