WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/19/2017 07:38:21 AM (3 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:
2 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']
Note: See TracChangeset for help on using the changeset viewer.