From fcd66d09d9133846d90669a9ddfb3fc765fcfec9 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Mon, 14 Jan 2019 05:05:48 +0000 Subject: [PATCH] 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 --- wp-includes/version.php | 2 +- wp-includes/widgets/class-wp-widget-text.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index 04cf465538..f4f3be5b11 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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. diff --git a/wp-includes/widgets/class-wp-widget-text.php b/wp-includes/widgets/class-wp-widget-text.php index b4f4aa2b99..8db1735198 100644 --- a/wp-includes/widgets/class-wp-widget-text.php +++ b/wp-includes/widgets/class-wp-widget-text.php @@ -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( '%s', @@ -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.