tedem / mybb-relator

Another nofollow plugin. By adding `rel="nofollow ugc noopener external"` tag to your outbound links, it informs the bots about the quality of your link and ensures that you don't give backlinks to third-party sites.
https://tedem.dev
MIT License
0 stars 0 forks source link

HTML5 tags error with loadHTML #1

Open firstboy000 opened 4 months ago

firstboy000 commented 4 months ago

Hi, thx for this plugins. ❤️

I used this, and error logs generated this:

<error>
    <dateline>1721216881</dateline>
    <script>inc/plugins/relator.php</script>
    <line>130</line>
    <type>2</type>
    <friendly_type>Warning</friendly_type>
    <message>DOMDocument::loadHTML(): Tag audio invalid in Entity, line: 17</message>
    <back_trace>#0  errorHandler->error() called at [/inc/class_error.php:153]
#1  errorHandler->error_callback() called at [[PHP]: ]
#2  DOMDocument->loadHTML() called at [/inc/plugins/relator.php:130]
#3  relator_main() called at [/inc/class_plugins.php:142]
#4  pluginSystem->run_hooks() called at [/inc/functions_post.php:898]
#5  build_postbit() called at [/showthread.php:1121]
</back_trace>
</error>

We use MyCode to convert MP3 and MP4 links into a player (basic audio or video tag).

To bypass this, I use the following option at line 130:

$dom->loadHTML('<div>' . $contents . '</div>', \LIBXML_HTML_NOIMPLIED | \LIBXML_HTML_NODEFDTD | \LIBXML_NOERROR);

Note: LIBXML_NOWARNING has a bug in my PHP version and does not work.

tedem commented 4 months ago

Thank you. I will try to correct it as soon as possible.