Widgets: Don't log invalid HTML in the Text Widget.

[41215] supresses these irrelevant error messages from the front end, this removes them from the error log, too.

Props jeherve.
Fixes #43815.


Built from https://develop.svn.wordpress.org/trunk@44578


git-svn-id: http://core.svn.wordpress.org/trunk@44409 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2019-01-14 05:05:48 +00:00
parent 5ed789dc63
commit fcd66d09d9
2 changed files with 6 additions and 1 deletions

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.1-beta1-44577';
$wp_version = '5.1-beta1-44578';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -120,6 +120,9 @@ class WP_Widget_Text extends WP_Widget {
}
$doc = new DOMDocument();
// Suppress warnings generated by loadHTML
$errors = libxml_use_internal_errors( true );
@$doc->loadHTML(
sprintf(
'<!DOCTYPE html><html><head><meta charset="%s"></head><body>%s</body></html>',
@ -127,6 +130,8 @@ class WP_Widget_Text extends WP_Widget {
$instance['text']
)
);
libxml_use_internal_errors( $errors );
$body = $doc->getElementsByTagName( 'body' )->item( 0 );
// See $allowedposttags.