Make WordPress Core

Changeset 44578


Ignore:
Timestamp:
01/14/2019 05:04:12 AM (4 years ago)
Author:
pento
Message:

Widgets: Don't log invalid HTML in the Text Widget.

[41215] supresses these irrelevant error messages from the front end, this removes them from the error log, too.

Props jeherve.
Fixes #43815.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/widgets/class-wp-widget-text.php

    r44574 r44578  
    121121
    122122        $doc = new DOMDocument();
     123
     124        // Suppress warnings generated by loadHTML
     125        $errors = libxml_use_internal_errors( true );
    123126        @$doc->loadHTML(
    124127            sprintf(
     
    128131            )
    129132        );
     133        libxml_use_internal_errors( $errors );
     134
    130135        $body = $doc->getElementsByTagName( 'body' )->item( 0 );
    131136
  • trunk/tests/phpunit/tests/widgets/text-widget.php

    r43571 r44578  
    573573            '<span class="hello"></span>',
    574574            '<blockquote>Quote <footer>Citation</footer></blockquote>',
     575            '<img src=\"http://example.com/img.jpg\" border=\"0\" title=\"Example\" /></a>',
    575576            '<span></span>',
    576577            "<ul>\n<li><a href=\"#\" class=\"location\"></a>List Item 1</li>\n<li><a href=\"#\" class=\"location\"></a>List Item 2</li>\n</ul>",
Note: See TracChangeset for help on using the changeset viewer.