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. git-svn-id: https://develop.svn.wordpress.org/trunk@41251 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
0e31ef4e2c
commit
242efb0a24
|
@ -116,8 +116,8 @@ class WP_Widget_Text extends WP_Widget {
|
||||||
}
|
}
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
$doc->loadHTML( sprintf(
|
@$doc->loadHTML( sprintf(
|
||||||
'<html><head><meta charset="%s"></head><body>%s</body></html>',
|
'<!DOCTYPE html><html><head><meta charset="%s"></head><body>%s</body></html>',
|
||||||
esc_attr( get_bloginfo( 'charset' ) ),
|
esc_attr( get_bloginfo( 'charset' ) ),
|
||||||
$instance['text']
|
$instance['text']
|
||||||
) );
|
) );
|
||||||
|
|
|
@ -397,6 +397,7 @@ class Test_WP_Widget_Text extends WP_UnitTestCase {
|
||||||
// Check text examples that will not migrate to TinyMCE.
|
// Check text examples that will not migrate to TinyMCE.
|
||||||
$legacy_text_examples = array(
|
$legacy_text_examples = array(
|
||||||
'<span class="hello"></span>',
|
'<span class="hello"></span>',
|
||||||
|
'<blockquote>Quote <footer>Citation</footer></blockquote>',
|
||||||
'<span></span>',
|
'<span></span>',
|
||||||
"<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>",
|
"<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>",
|
||||||
'<a href="#" class="map"></a>',
|
'<a href="#" class="map"></a>',
|
||||||
|
|
Loading…
Reference in New Issue