Repository navigation
[xExtension-YouTube] Silence DOM warnings when showing the feed content - #556
Merged
Merged
Conversation
When "Display the feeds content" is enabled, getHtml() parses the entry
content with DOMDocument::loadHTML() to extract the enclosure title,
thumbnail and description. FreshRSS renders enclosures with HTML5 tags
such as <figure>, <figcaption> and <video>, which the libxml HTML 4
parser does not know, so every YouTube entry emitted warnings like:
Warning: DOMDocument::loadHTML(): Tag figure invalid in Entity
These warnings were printed in the middle of the article stream and
filled the logs.
Pass LIBXML_NONET | LIBXML_NOERROR | LIBXML_NOWARNING to loadHTML(),
the same flags FreshRSS core and this extension's icon downloader
already use when parsing third-party HTML. The parser still recovers
the same tree, so the generated content is unchanged.
Bump the extension version to 1.3.2.
Fixes FreshRSS#222
Inverle
approved these changes
Oct 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LIBXML_NONET | LIBXML_NOERROR | LIBXML_NOWARNINGto theDOMDocument::loadHTML()call used when Display the feeds content is enabledFixes #222
Root cause
With Display the feeds content enabled,
getHtml()parses$entry->content()to extract the enclosure title, thumbnail and description. FreshRSS renders enclosures with HTML5 tags (<figure>,<figcaption>,<video>), which the libxml HTML 4 parser does not know. As a result, every YouTube entry produced warnings such as:These warnings appeared in the middle of the article stream and filled the logs.
The same flags are already used by FreshRSS core (e.g.
FreshRSS_Entry,FreshRSS_Feed,lib/favicons.php) and by this extension's own icon downloader. The parser still recovers the same tree, so the generated content is unchanged. This is the stop-gap suggested in the issue until the PHP 8.4+ HTML5 parser can be used (#494).Validation
getHtml()against FreshRSSedgewith an entry whose enclosure is rendered byFreshRSS_Entry::content(), on PHP 8.2 and PHP 8.5: before the change 4 warnings were emitted (figure,video,figcaption, entity ref), after the change none, and the generated HTML is byte-for-byte identicalcomposer run-script php-lint,composer run-script phtml-lint,phpcs,phpstan(with../FreshRSS)markdownlint-cli2on the README