Undefined property: DOMElement::$tagName with PHP 7.0.24 and 7.1.10

  • On my server (I use Namecheap shared hosting) it runs on PHP 5.6 but has errors with PHP 7.0 and 7.1. What PHP version should WSF be able to run on?

  • 5.6 should be fine, same for 7.0 and 7.1... (All my sites run on 7.1.x without an issue... before on 7.0.x)

    Viele Grüsse aus Stuttgart, Kind Regards from Stuttgart
    TheSonic

  • What issues do you have running 7.x? Perhaps something Host-Related...? I'm also a TechAdmin of other sites and i also moved them to PHP 7, even on shared hosts, without an issue... So i'm little bit confused....

    Viele Grüsse aus Stuttgart, Kind Regards from Stuttgart
    TheSonic

  • Most likely it's host related.


    With 5.6 everything runs fine.


    With 7.0 WSF displays fine, but when I edit a post or try to post I get this error:



  • Lookup the error message in your ACP by using the above id, it is randomly generated for each error. The software runs fine on both PHP 7.0 and 7.1, woltlab.com uses 7.0.

    Alexander Ebert
    Senior Developer WoltLab® GmbH

  • Here's the error. Needless to say I don't know how to decipher it :)


    Thu, 05 Oct 2017 19:39:09 +0000

    Message: Undefined property: DOMElement::$tagName

    PHP version: 7.0.24

    WoltLab Suite version: 3.0.9

    Request URI: /index.php?ajax-proxy/&t=f9634fc7ee3fb52e40ce522298dd190604387a1c

    Referrer: http://mydomain.com/thread/7547-kingy/?postID=103403

    User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0

    Peak Memory Usage: 10625992/134217728

    ======

    Error Class: wcf\system\exception\ErrorException

    Error Message: Undefined property: DOMElement::$tagName

    Error Code: 0

    File: /home/user/public_html/mydomain.com/forum/lib/system/WCF.class.php (313)

    Extra Information: -

    Stack Trace: [{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/api\/ezyang\/htmlpurifier\/library\/HTMLPurifier\/Lexer\/DOMLex.php","line":186,"function":"handleError","class":"wcf\\system\\WCF","type":"::","args":[8,"Undefined property: DOMElement::$tagName","\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/api\/ezyang\/htmlpurifier\/library\/HTMLPurifier\/Lexer\/DOMLex.php",186,{"node":"[redacted]","tokens":"[redacted]","collect":"[redacted]","config":"[redacted]","attr":"[redacted]"}]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/api\/ezyang\/htmlpurifier\/library\/HTMLPurifier\/Lexer\/DOMLex.php","line":108,"function":"createStartNode","class":"HTMLPurifier_Lexer_DOMLex","type":"->","args":["DOMElement",[],true,"HTMLPurifier_Config"]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/api\/ezyang\/htmlpurifier\/library\/HTMLPurifier\/Lexer\/DOMLex.php","line":80,"function":"tokenizeDOM","class":"HTMLPurifier_Lexer_DOMLex","type":"->","args":["DOMElement",[],"HTMLPurifier_Config"]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/api\/ezyang\/htmlpurifier\/library\/HTMLPurifier.php","line":215,"function":"tokenizeHTML","class":"HTMLPurifier_Lexer_DOMLex","type":"->","args":["<\/head>

    asdf<\/p><\/div><\/body><\/html>","HTMLPurifier_Config","HTMLPurifier_Context"]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/html\/input\/filter\/MessageHtmlInputFilter.class.php","line":33,"function":"purify","class":"HTMLPurifier","type":"->","args":["

    asdf<\/p>"]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/html\/input\/HtmlInputProcessor.class.php","line":61,"function":"apply","class":"wcf\\system\\html\\input\\filter\\MessageHtmlInputFilter","type":"->","args":["

    asdf<\/p>"]},{"file":"\/home\/user\/public_html\/mydomain.com\/lib\/data\/post\/PostAction.class.php","line":3226,"function":"process","class":"wcf\\system\\html\\input\\HtmlInputProcessor","type":"->","args":["

    asdf<\/p>","com.woltlab.wbb.post",0]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/message\/QuickReplyManager.class.php","line":141,"function":"getHtmlInputProcessor","class":"wbb\\data\\post\\PostAction","type":"->","args":["

    asdf<\/p>"]},{"file":"\/home\/user\/public_html\/mydomain.com\/lib\/data\/post\/PostAction.class.php","line":1645,"function":"validateParameters","class":"wcf\\system\\message\\QuickReplyManager","type":"->","args":["wbb\\data\\post\\PostAction",{"objectID":"[redacted]","lastPostTime":"[redacted]","pageNo":"[redacted]","anchor":"[redacted]","sortOrder":"[redacted]","data":"[redacted]","subscribeThread":"[redacted]"},"wbb\\data\\thread\\Thread","wbb\\data\\thread\\ViewableThread"]},{"function":"validateQuickReply","class":"wbb\\data\\post\\PostAction","type":"->","args":["7547","1507142939","1","http:\/\/mydomain.com\/thread\/7547-kingy\/?postID=103403#top","ASC",{"message":"[redacted]","tmpHash":"[redacted]"},"1"],"file":"[internal function]","line":"?"},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/data\/AbstractDatabaseObjectAction.class.php","line":189,"function":"call_user_func_array","args":[["[redacted]","[redacted]"],{"objectID":"[redacted]","lastPostTime":"[redacted]","pageNo":"[redacted]","anchor":"[redacted]","sortOrder":"[redacted]","data":"[redacted]","subscribeThread":"[redacted]"}],"class":"","type":""},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/action\/AJAXProxyAction.class.php","line":71,"function":"validateAction","class":"wcf\\data\\AbstractDatabaseObjectAction","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/action\/AJAXInvokeAction.class.php","line":104,"function":"invoke","class":"wcf\\action\\AJAXProxyAction","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/action\/AbstractAction.class.php","line":47,"function":"execute","class":"wcf\\action\\AJAXInvokeAction","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/action\/AJAXInvokeAction.class.php","line":63,"function":"__run","class":"wcf\\action\\AbstractAction","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/request\/Request.class.php","line":83,"function":"__run","class":"wcf\\action\\AJAXInvokeAction","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/request\/RequestHandler.class.php","line":94,"function":"execute","class":"wcf\\system\\request\\Request","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/index.php","line":9,"function":"handle","class":"wcf\\system\\request\\RequestHandler","type":"->","args":["wbb"]}]

  • That error message is really weird and doesn't really make sense to me. Is there something "special" about the message you're trying to reply or is it just some plain text? Are you able to use PHP 7.1, and if yes, does it happen there too?

    Alexander Ebert
    Senior Developer WoltLab® GmbH

  • Nothing special just reply with plain text.


    I switched from 5.6 to 7.0, this is the error:


    Thu, 05 Oct 2017 23:29:25 +0000

    Message: Undefined property: DOMElement::$tagName

    PHP version: 7.0.24

    WoltLab Suite version: 3.0.9

    Request URI: /index.php?ajax-proxy/&t=e26039f0f133d950529206679d54468329ec44f4

    Referrer: http://mydomain.com/thread/7547-kingy/?postID=103403

    User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0

    Peak Memory Usage: 10625992/134217728

    ======

    Error Class: wcf\system\exception\ErrorException

    Error Message: Undefined property: DOMElement::$tagName

    Error Code: 0

    File: /home/user/public_html/mydomain.com/forum/lib/system/WCF.class.php (313)

    Extra Information: -

    Stack Trace: [{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/api\/ezyang\/htmlpurifier\/library\/HTMLPurifier\/Lexer\/DOMLex.php","line":186,"function":"handleError","class":"wcf\\system\\WCF","type":"::","args":[8,"Undefined property: DOMElement::$tagName","\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/api\/ezyang\/htmlpurifier\/library\/HTMLPurifier\/Lexer\/DOMLex.php",186,{"node":"[redacted]","tokens":"[redacted]","collect":"[redacted]","config":"[redacted]","attr":"[redacted]"}]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/api\/ezyang\/htmlpurifier\/library\/HTMLPurifier\/Lexer\/DOMLex.php","line":108,"function":"createStartNode","class":"HTMLPurifier_Lexer_DOMLex","type":"->","args":["DOMElement",[],true,"HTMLPurifier_Config"]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/api\/ezyang\/htmlpurifier\/library\/HTMLPurifier\/Lexer\/DOMLex.php","line":80,"function":"tokenizeDOM","class":"HTMLPurifier_Lexer_DOMLex","type":"->","args":["DOMElement",[],"HTMLPurifier_Config"]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/api\/ezyang\/htmlpurifier\/library\/HTMLPurifier.php","line":215,"function":"tokenizeHTML","class":"HTMLPurifier_Lexer_DOMLex","type":"->","args":["<\/head>

    test<\/p><\/div><\/body><\/html>","HTMLPurifier_Config","HTMLPurifier_Context"]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/html\/input\/filter\/MessageHtmlInputFilter.class.php","line":33,"function":"purify","class":"HTMLPurifier","type":"->","args":["

    test<\/p>"]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/html\/input\/HtmlInputProcessor.class.php","line":61,"function":"apply","class":"wcf\\system\\html\\input\\filter\\MessageHtmlInputFilter","type":"->","args":["

    test<\/p>"]},{"file":"\/home\/user\/public_html\/mydomain.com\/lib\/data\/post\/PostAction.class.php","line":3226,"function":"process","class":"wcf\\system\\html\\input\\HtmlInputProcessor","type":"->","args":["

    test<\/p>","com.woltlab.wbb.post",0]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/message\/QuickReplyManager.class.php","line":141,"function":"getHtmlInputProcessor","class":"wbb\\data\\post\\PostAction","type":"->","args":["

    test<\/p>"]},{"file":"\/home\/user\/public_html\/mydomain.com\/lib\/data\/post\/PostAction.class.php","line":1645,"function":"validateParameters","class":"wcf\\system\\message\\QuickReplyManager","type":"->","args":["wbb\\data\\post\\PostAction",{"objectID":"[redacted]","lastPostTime":"[redacted]","pageNo":"[redacted]","anchor":"[redacted]","sortOrder":"[redacted]","data":"[redacted]","subscribeThread":"[redacted]"},"wbb\\data\\thread\\Thread","wbb\\data\\thread\\ViewableThread"]},{"function":"validateQuickReply","class":"wbb\\data\\post\\PostAction","type":"->","args":["7547","1507142939","1","http:\/\/mydomain.com\/thread\/7547-kingy\/?postID=103403#top","ASC",{"message":"[redacted]","tmpHash":"[redacted]"},"1"],"file":"[internal function]","line":"?"},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/data\/AbstractDatabaseObjectAction.class.php","line":189,"function":"call_user_func_array","args":[["[redacted]","[redacted]"],{"objectID":"[redacted]","lastPostTime":"[redacted]","pageNo":"[redacted]","anchor":"[redacted]","sortOrder":"[redacted]","data":"[redacted]","subscribeThread":"[redacted]"}],"class":"","type":""},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/action\/AJAXProxyAction.class.php","line":71,"function":"validateAction","class":"wcf\\data\\AbstractDatabaseObjectAction","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/action\/AJAXInvokeAction.class.php","line":104,"function":"invoke","class":"wcf\\action\\AJAXProxyAction","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/action\/AbstractAction.class.php","line":47,"function":"execute","class":"wcf\\action\\AJAXInvokeAction","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/action\/AJAXInvokeAction.class.php","line":63,"function":"__run","class":"wcf\\action\\AbstractAction","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/request\/Request.class.php","line":83,"function":"__run","class":"wcf\\action\\AJAXInvokeAction","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/request\/RequestHandler.class.php","line":94,"function":"execute","class":"wcf\\system\\request\\Request","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/index.php","line":9,"function":"handle","class":"wcf\\system\\request\\RequestHandler","type":"->","args":["wbb"]}]

  • Now I switched from 7.0 to 7.1, this is the error:


    Thu, 05 Oct 2017 23:32:31 +0000

    Message: Undefined property: DOMElement::$tagName

    PHP version: 7.1.10

    WoltLab Suite version: 3.0.9

    Request URI: /index.php?ajax-proxy/&t=e26039f0f133d950529206679d54468329ec44f4

    Referrer: http://mydomain.com/thread/7547-kingy/?postID=103403

    User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0

    Peak Memory Usage: 10620968/134217728

    ======

    Error Class: wcf\system\exception\ErrorException

    Error Message: Undefined property: DOMElement::$tagName

    Error Code: 0

    File: /home/user/public_html/mydomain.com/forum/lib/system/WCF.class.php (313)

    Extra Information: -

    Stack Trace: [{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/api\/ezyang\/htmlpurifier\/library\/HTMLPurifier\/Lexer\/DOMLex.php","line":186,"function":"handleError","class":"wcf\\system\\WCF","type":"::","args":[8,"Undefined property: DOMElement::$tagName","\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/api\/ezyang\/htmlpurifier\/library\/HTMLPurifier\/Lexer\/DOMLex.php",186,{"node":"[redacted]","tokens":"[redacted]","collect":"[redacted]","config":"[redacted]","attr":"[redacted]"}]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/api\/ezyang\/htmlpurifier\/library\/HTMLPurifier\/Lexer\/DOMLex.php","line":108,"function":"createStartNode","class":"HTMLPurifier_Lexer_DOMLex","type":"->","args":["DOMElement",[],true,"HTMLPurifier_Config"]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/api\/ezyang\/htmlpurifier\/library\/HTMLPurifier\/Lexer\/DOMLex.php","line":80,"function":"tokenizeDOM","class":"HTMLPurifier_Lexer_DOMLex","type":"->","args":["DOMElement",[],"HTMLPurifier_Config"]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/api\/ezyang\/htmlpurifier\/library\/HTMLPurifier.php","line":215,"function":"tokenizeHTML","class":"HTMLPurifier_Lexer_DOMLex","type":"->","args":["<\/head>

    test<\/p><\/div><\/body><\/html>","HTMLPurifier_Config","HTMLPurifier_Context"]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/html\/input\/filter\/MessageHtmlInputFilter.class.php","line":33,"function":"purify","class":"HTMLPurifier","type":"->","args":["

    test<\/p>"]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/html\/input\/HtmlInputProcessor.class.php","line":61,"function":"apply","class":"wcf\\system\\html\\input\\filter\\MessageHtmlInputFilter","type":"->","args":["

    test<\/p>"]},{"file":"\/home\/user\/public_html\/mydomain.com\/lib\/data\/post\/PostAction.class.php","line":3226,"function":"process","class":"wcf\\system\\html\\input\\HtmlInputProcessor","type":"->","args":["

    test<\/p>","com.woltlab.wbb.post",0]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/message\/QuickReplyManager.class.php","line":141,"function":"getHtmlInputProcessor","class":"wbb\\data\\post\\PostAction","type":"->","args":["

    test<\/p>"]},{"file":"\/home\/user\/public_html\/mydomain.com\/lib\/data\/post\/PostAction.class.php","line":1645,"function":"validateParameters","class":"wcf\\system\\message\\QuickReplyManager","type":"->","args":["wbb\\data\\post\\PostAction",{"objectID":"[redacted]","lastPostTime":"[redacted]","pageNo":"[redacted]","anchor":"[redacted]","sortOrder":"[redacted]","data":"[redacted]","subscribeThread":"[redacted]"},"wbb\\data\\thread\\Thread","wbb\\data\\thread\\ViewableThread"]},{"function":"validateQuickReply","class":"wbb\\data\\post\\PostAction","type":"->","args":["7547","1507142939","1","http:\/\/mydomain.com\/thread\/7547-kingy\/?postID=103403#top","ASC",{"message":"[redacted]","tmpHash":"[redacted]"},"1"],"file":"[internal function]","line":"?"},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/data\/AbstractDatabaseObjectAction.class.php","line":189,"function":"call_user_func_array","args":[["[redacted]","[redacted]"],{"objectID":"[redacted]","lastPostTime":"[redacted]","pageNo":"[redacted]","anchor":"[redacted]","sortOrder":"[redacted]","data":"[redacted]","subscribeThread":"[redacted]"}],"class":"","type":""},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/action\/AJAXProxyAction.class.php","line":71,"function":"validateAction","class":"wcf\\data\\AbstractDatabaseObjectAction","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/action\/AJAXInvokeAction.class.php","line":104,"function":"invoke","class":"wcf\\action\\AJAXProxyAction","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/action\/AbstractAction.class.php","line":47,"function":"execute","class":"wcf\\action\\AJAXInvokeAction","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/action\/AJAXInvokeAction.class.php","line":63,"function":"__run","class":"wcf\\action\\AbstractAction","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/request\/Request.class.php","line":83,"function":"__run","class":"wcf\\action\\AJAXInvokeAction","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/forum\/lib\/system\/request\/RequestHandler.class.php","line":94,"function":"execute","class":"wcf\\system\\request\\Request","type":"->","args":[]},{"file":"\/home\/user\/public_html\/mydomain.com\/index.php","line":9,"function":"handle","class":"wcf\\system\\request\\RequestHandler","type":"->","args":["wbb"]}]

  • Thanks for taking your time to verify this issue for 7.1 too, we'll have to investigate the cause of this. According to the version strings above, you're using the latest versions of 7.0/7.1, so there is a chance that this is an issue with PHP itself, or at least caused by a change in PHP.


    You should consider switching back to 5.6 for the time being.

    Alexander Ebert
    Senior Developer WoltLab® GmbH

  • I can't reproduce that error. I'm also running php 7.1.10! Also I asume many other user are using it. So if it would be a general php issue, the uproar would have been much louder, wouldn't it?

  • I don't know if it's relevant but I have other sites on the same server running fine with php 7.1 including wordpress and chevereto.

  • I cannot reproduce this issue with any of the two versions, and looking through the code changes in these PHP versions, there is nothing that would even remotely explain the cause. Maybe something with the builds used by your host went wrong and the DOM extension is somewhat damaged, so you may just want to wait until the next release to see if that fixes it for you.

    Alexander Ebert
    Senior Developer WoltLab® GmbH

  • I got this resolved by asking the hosting company to look into it. Namecheap is pretty good with support but whenever things get a little complicated you inevitably hit the wall of..

    Quote
    We have tried pinpointing the exact cause of the matter, but unfortunately, code debugging assistance is out of scope of our support, so we weren't able to locate the reason for why 'DOMElement::$tagName' is stated as undefined in the log of your site. We have switched the PHP version back to 5.6 so that it wouldn't disrupt your site's work. If you wish to use PHP7, we would suggest contacting your developer to investigate the issue further.

    And inevitably I respond with..


    Quote
     

    I can’t accept that. Because the problem exists for two different software that should work perfectly with php 7; Prestashop (latest version) and Woltlab (latest version). Both developers already stated to me that it’s not a software problem. It’s too much of a coincidence that two completely unrelated software that work on other servers with php 7, do not work with yours. Please look deeper into this problem or I will be forced to find another hosting company. I can’t stay with php 5.6 forever.


    The next email I get is

    Quote
    We have managed to track down the root cause of the issue which was related to the conflict that had occurred in the PHP configuration file for the extensions pdo and dom.

    So my Woltlab forum is now working perfectly with PHP 7.1. Hope this helps someone who's in the same boat.

  • So my Woltlab forum is now working perfectly with PHP 7.1

    Glad to hear this!


    In their defense, PHP can be a real mess when it comes to all the side-effects of changes to the configuration and its extensions. Think of PHP as a wadded pile of paper that is held together by duct tape. Yep, that's pretty much accurate.

    Alexander Ebert
    Senior Developer WoltLab® GmbH