I am receiving the warnings below on widgets that I create from views. These warnings appear within the embedded widgets themselves on outside (non-Drupal) websites, and force people to scroll down below the warnings to view the intended content of the widgets. The same warnings also appear on some admin pages, such as the blocks list page.
warning: DOMDocument::loadHTML() [domdocument.loadhtml]: Unexpected end tag : a in Entity, line: 14 in /Applications/drupal-6.16-0/apps/drupal/htdocs/sites/all/modules/embed_widgets/embed_widgets.module on line 523.
warning: DOMDocument::loadHTML() [domdocument.loadhtml]: Unexpected end tag : a in Entity, line: 221 in /Applications/drupal-6.16-0/apps/drupal/htdocs/sites/all/modules/embed_widgets/embed_widgets.module on line 523.
warning: DOMDocument::loadHTML() [domdocument.loadhtml]: Unexpected end tag : a in Entity, line: 227 in /Applications/drupal-6.16-0/apps/drupal/htdocs/sites/all/modules/embed_widgets/embed_widgets.module on line 523.
warning: DOMDocument::loadHTML() [domdocument.loadhtml]: Unexpected end tag : a in Entity, line: 233 in /Applications/drupal-6.16-0/apps/drupal/htdocs/sites/all/modules/embed_widgets/embed_widgets.module on line 523.
warning: DOMDocument::loadHTML() [domdocument.loadhtml]: Unexpected end tag : a in Entity, line: 239 in /Applications/drupal-6.16-0/apps/drupal/htdocs/sites/all/modules/embed_widgets/embed_widgets.module on line 523.
warning: DOMDocument::loadHTML() [domdocument.loadhtml]: Unexpected end tag : a in Entity, line: 245 in /Applications/drupal-6.16-0/apps/drupal/htdocs/sites/all/modules/embed_widgets/embed_widgets.module on line 523.
The warnings are intermittent. If I refresh a page several times, the warnings may disappear sometimes, then return again.
I am running Drupal 6.16 with the latest 6.x-2.x-dev Embed widgets. Please let me know if you require other information.
At a minimum, I would like a way to suppress these warnings so that they do not obscure the content that widgets display. Embed widgets seems like it has great potential, but it is not usable for me as long as it frequently displays warnings in the widgets themselves.
Thank you.
Comments
Comment #1
skolesnyk commentedSubscribing, same problem.
Comment #2
inari commentedThere's a workaround I am using to suppress the warnings, which might help you, skolesnyk. It's not ideal since it doesn't get to the root of the problem, but it seems to do the job for me in making the warnings go away.
I was able to suppress the warnings completely by adding a @ to the beginning of the code referred to as line 523 of embed_widgets.module.
Was:
$dom->loadHTML(mb_convert_encoding($string, 'HTML-ENTITIES', "UTF-8"));Is now:
@$dom->loadHTML(mb_convert_encoding($string, 'HTML-ENTITIES', "UTF-8"));If the problem is not solved in future versions of Embed Widgets, a similar fix will be needed each time the module is upgraded.
An explanation of the use of @ to suppress warnings and errors in PHP can be found here:
http://php.net/manual/en/language.operators.errorcontrol.php
Comment #3
saipas commentedOr you just go to /admin/settings/error-reporting and change the "error reporting" setting to "write errors to the log". That way no errors are shown at all to users on your prod site.
These DOM issues are related to your HTML page having non-valid markup. In your case your links are incorrect. Check it directly on http://validator.w3.org/ to find the root of the issue.
Once you have corrected your code, the warning will disappear.
Since I'm here, here's another trick in the case you're using FB Connect. Because FB tags are not valid HTML markup, you need to strip them before loading the DOM document. Add
$string = strip_only($string, 'fb', true);beforeline 543 in embed_widgets.module 6.x-2.x-dev
Hope that helped!
Bye,
saipas
Comment #4
inari commentedThanks, saipas! I appreciate your help.
Comment #5
saipas commentedMy pleasure.
I forgot to include the "strip_tags" function (found on php.com) for the Fb Connect trick: