WordPress.org

Make WordPress Core


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.

File:
1 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']
Note: See TracChangeset for help on using the changeset viewer.