Having an issue, default mail system works, all other (mime, newsletter) also works, but HTML mail refuse to work. Each time webform / order (drupal commerce) is sent, website goes to WSOD with a message "an error has occured"
Log says:
TypeError: Argument 1 passed to _mailsystem_html_to_text() must be an instance of DOMNode, null given, called in /var/www/mpt.sk/public_html/sites/all/modules/mailsystem/html_to_text.inc on line 122 v _mailsystem_html_to_text() (riadok 161 z /var/www/mpt.sk/public_html/sites/all/modules/mailsystem/html_to_text.inc).
Not sure how to solve this, was not able to find anything relevant in issue thread or anywhere on internet. Note that my server runs PHP Version 7.0.26-1+ubuntu14.04.1+deb.sury.org+1
However the issue is not present on our test server (basic hosting configuration) also running php 7.0, might some package not be installed? When I checked the line it looks like "$dom->documentElement" is blank but I am not sure, not a good coder.
Thanks for any advice.
Comments
Comment #2
lubwn CreditAttribution: lubwn commentedI did fixed this issue by somehow, not sure whether the fix is stable or not, but it works for now.
On line 122 in file html_to_text.inc change this:
$text = _mailsystem_html_to_text($dom->documentElement, $allowed_tags, $notes);
To this:
$text = _mailsystem_html_to_text($dom, $allowed_tags, $notes);
I noticed that
$dom
in this context does not have available propertydocumentElement
in printed array, it is just missing despite the fact that in the official PHP documentationdocumentElement
property should be always available.I think this is not a problem of module itself, but rather configuration of my server or PHP itself, not sure, however it works for now so maybe it will help someone in the future.
Comment #3
salvisThank you for reporting this and documenting your fix, which is actually in mailsystem, not in htmlmail.
Here's what we're looking at:
htmlmail does use this function, but it's only passing a string. The function then calls filter_dom_load() to create the contents of the $dom variable.
Can you try to find out what the strings are that are being passed in to mailsystem_html_to_text() either on your test server or your production server?
Maybe you're looking at a situation like
#1494910: mailsystem_html_to_text() function did not return any text or
#1786546: mailsystem_html_to_text() function did not return any text
and this throws an error now with PHP 7 and it used to just return an empty string under earlier versions?
Comment #4
salvisAlso, please try the 2.70 version!
Comment #5
TR CreditAttribution: TR commented