Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Fatal error: Uncaught Error: Typed property DOMDocument::$documentElement must not be accessed before initialization in /var/www/roundcube/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php:275 #8826

Closed
iUnstable0 opened this issue Dec 22, 2022 · 7 comments

Comments

@iUnstable0
Copy link

[22-Dec-2022 20:55:00 Asia/Krasnoyarsk] PHP Fatal error:  Uncaught Error: Typed property DOMDocument::$documentElement must not be accessed before initialization in /var/www/roundcube/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php:275
Stack trace:
#0 /var/www/roundcube/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php(399): Masterminds\HTML5\Parser\DOMTreeBuilder->startTag()
#1 /var/www/roundcube/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php(141): Masterminds\HTML5\Parser\Tokenizer->tagName()
#2 /var/www/roundcube/vendor/masterminds/html5/src/HTML5/Parser/Tokenizer.php(82): Masterminds\HTML5\Parser\Tokenizer->consumeData()
#3 /var/www/roundcube/vendor/masterminds/html5/src/HTML5.php(161): Masterminds\HTML5\Parser\Tokenizer->parse()
#4 /var/www/roundcube/vendor/masterminds/html5/src/HTML5.php(89): Masterminds\HTML5->parse()
#5 /var/www/roundcube/program/lib/Roundcube/rcube_washtml.php(698): Masterminds\HTML5->loadHTML()
#6 /var/www/roundcube/program/actions/mail/index.php(977): rcube_washtml->wash()
#7 /var/www/roundcube/program/actions/mail/index.php(1021): rcmail_action_mail_index::wash_html()
#8 /var/www/roundcube/program/actions/mail/show.php(748): rcmail_action_mail_index::print_body()
#9 /var/www/roundcube/program/include/rcmail_output_html.php(1484): rcmail_action_mail_show::message_body()
#10 [internal function]: rcmail_output_html->xml_command()
#11 /var/www/roundcube/program/include/rcmail_output_html.php(1322): preg_replace_callback()
#12 /var/www/roundcube/program/include/rcmail_output_html.php(825): rcmail_output_html->parse_xml()
#13 /var/www/roundcube/program/include/rcmail_output_html.php(654): rcmail_output_html->parse()
#14 /var/www/roundcube/program/actions/mail/show.php(164): rcmail_output_html->send()
#15 /var/www/roundcube/program/include/rcmail.php(275): rcmail_action_mail_show->run()
#16 /var/www/roundcube/index.php(278): rcmail->action_handler()
#17 {main}
  thrown in /var/www/roundcube/vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php on line 275

this error happens when I try to open some emails, this is very weird as it never happened before now it just happened randomly for no reason, emails that used to work now wont open and instead throw that error

@iUnstable0
Copy link
Author

Btw im using php 8.1 fpm nginx fastCGI (Im new to PHP I think I might've accidentally caused this but I'm not sure, what I'm sure is I never touched Roundcube internal PHP code only plugins code)

@iUnstable0
Copy link
Author

iUnstable0 commented Dec 22, 2022

Okay this doesnt happen to messages sent from other email address but from swisscows.email address.
(Swisscows worked just fine, it just started giving errors today)

@iUnstable0
Copy link
Author

OK I tested it happens to HTML messages, not plaintext

@alecpl
Copy link
Member

alecpl commented Dec 31, 2022

I'm unable to reproduce, but I created an upstream ticket Masterminds/html5-php#220

@stof
Copy link

stof commented Jan 11, 2023

Taking the HTML content of that email (after decoding the quoted-printable encoding) and parsing it with the html5-php library does not produce any error. So the upstream report is not actionable.

@alecpl
Copy link
Member

alecpl commented Jan 29, 2023

@iUnstable0 what PHP version exactly? Could you try with most recent PHP 8.2.x?

@iUnstable0
Copy link
Author

@iUnstable0 what PHP version exactly? Could you try with most recent PHP 8.2.x?

I just upgraded to php8.2-fpm and roundcube to 1.6.1 and the issue is fixed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants