WordPress.org

Make WordPress Core

Changeset 41391


Ignore:
Timestamp:
09/19/2017 07:38:21 AM (2 years ago)
Author:
ocean90
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.

Merge of [41251] to the 4.8 branch.

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

Location:
branches/4.8
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.8

  • branches/4.8/src/wp-includes/widgets/class-wp-widget-text.php

    r41135 r41391  
    116116
    117117        $doc = new DOMDocument();
    118         $doc->loadHTML( sprintf(
    119             '<html><head><meta charset="%s"></head><body>%s</body></html>',
     118        @$doc->loadHTML( sprintf(
     119            '<!DOCTYPE html><html><head><meta charset="%s"></head><body>%s</body></html>',
    120120            esc_attr( get_bloginfo( 'charset' ) ),
    121121            $instance['text']
  • branches/4.8/tests/phpunit/tests/widgets/text-widget.php

    r41135 r41391  
    397397        $legacy_text_examples = array(
    398398            '<span class="hello"></span>',
     399            '<blockquote>Quote <footer>Citation</footer></blockquote>',
    399400            '<span></span>',
    400401            "<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.