diff --git a/src/wp-includes/widgets/class-wp-widget-text.php b/src/wp-includes/widgets/class-wp-widget-text.php index e6d979347d..ef9e349aa4 100644 --- a/src/wp-includes/widgets/class-wp-widget-text.php +++ b/src/wp-includes/widgets/class-wp-widget-text.php @@ -116,8 +116,8 @@ class WP_Widget_Text extends WP_Widget { } $doc = new DOMDocument(); - $doc->loadHTML( sprintf( - '
%s', + @$doc->loadHTML( sprintf( + '%s', esc_attr( get_bloginfo( 'charset' ) ), $instance['text'] ) ); diff --git a/tests/phpunit/tests/widgets/text-widget.php b/tests/phpunit/tests/widgets/text-widget.php index 6c7ec1f102..9bc6edcad4 100644 --- a/tests/phpunit/tests/widgets/text-widget.php +++ b/tests/phpunit/tests/widgets/text-widget.php @@ -397,6 +397,7 @@ class Test_WP_Widget_Text extends WP_UnitTestCase { // Check text examples that will not migrate to TinyMCE. $legacy_text_examples = array( '', + 'Quote', '', "", '',