WordPress.org

Make WordPress Core

Changeset 41251


Ignore:
Timestamp:
08/14/2017 05:58:23 AM (2 years ago)
Author:
westonruter
Message:

Widgets: Suppress PHP warnings raised by DOMDocument::loadHTML() in WP_Widget_Text::is_legacy_instance() which could appear in Text widget forms.

Also explicitly use HTML5 doctype when parsing Text widget contents in legacy mode detection.

Amends [41050].
See #40951.
Fixes #41622.

Location:
trunk
Files:
2 edited

Legend:

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

    r41245 r41251  
    117117
    118118        $doc = new DOMDocument();
    119         $doc->loadHTML( sprintf(
    120             '<html><head><meta charset="%s"></head><body>%s</body></html>',
     119        @$doc->loadHTML( sprintf(
     120            '<!DOCTYPE html><html><head><meta charset="%s"></head><body>%s</body></html>',
    121121            esc_attr( get_bloginfo( 'charset' ) ),
    122122            $instance['text']
  • trunk/tests/phpunit/tests/widgets/text-widget.php

    r41245 r41251  
    398398        $legacy_text_examples = array(
    399399            '<span class="hello"></span>',
     400            '<blockquote>Quote <footer>Citation</footer></blockquote>',
    400401            '<span></span>',
    401402            "<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.