[wp-trac] [WordPress Trac] #43815: Text Widget: Warnings thrown when using invalid HTML in legacy mode

WordPress Trac noreply at wordpress.org
Thu Apr 19 21:09:58 UTC 2018


#43815: Text Widget: Warnings thrown when using invalid HTML in legacy mode
--------------------------+-----------------------------
 Reporter:  jeherve       |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Widgets       |    Version:  4.9
 Severity:  normal        |   Keywords:  has-patch
  Focuses:                |
--------------------------+-----------------------------
 **Steps to reproduce the issue**

 1. Start with a site running WP 4.7.10.
 2. Add a new Text Widget to your site with the following contents:

 {{{
 <img src="http://example.com/img.jpg" border="0" title="Example" /></a>
 }}}

 3. Update to WP 4.9.5
 4. Notice the widget still there under Appearance > Widgets.
 5. Load your site's front end.
 6. In your logs, you should see the following warning:

 {{{
 [Suppressed] Warning: DOMDocument::loadHTML(): Unexpected end tag : a in
 Entity, line: 1 in /home/wpcom/public_html/wp-includes/widgets/class-wp-
 widget-text.php on line 129
 }}}

 This seems to happen because of the invalid HTML in the widget.

 In #41622 and r41251, we suppressed those warnings. Unfortunately invalid
 HTML can still fill in logs. I think it would be nice if we could get rid
 of those warnings, with the attached patch.

 Let me know what you think about this!

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/43815>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list