Masterminds / Masterminds/html5-php
Typed property DOMDocument::$documentElement must not be accessed before initialization
Open
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1.8k
- Forks
- 122
- PR merge metrics
- No merged PRs in 30d
Description
I'm unable to reproduce, but one of Roundcube users created a ticket for this here.
This is with PHP 8.1.13:
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()
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in HTML5/Parser/DOMTreeBuilder.php around line 275, then trace the call path through Tokenizer.php and HTML5.php shown in the stack trace. Reproduce the reported PHP 8.1 failure if possible, and add a regression test demonstrating that parsing no longer accesses an uninitialized DOMDocument::$documentElement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100