mirror of
git://develop.git.wordpress.org/
synced 2025-04-21 04:31:55 +02:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@44578 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e547ecc791
commit
4550488c99
@ -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.
|
||||
|
@ -572,6 +572,7 @@ class Test_WP_Widget_Text extends WP_UnitTestCase {
|
||||
$legacy_text_examples = array(
|
||||
'<span class="hello"></span>',
|
||||
'<blockquote>Quote <footer>Citation</footer></blockquote>',
|
||||
'<img src=\"http://example.com/img.jpg\" border=\"0\" title=\"Example\" /></a>',
|
||||
'<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>",
|
||||
'<a href="#" class="map"></a>',
|
||||
|
Loading…
x
Reference in New Issue
Block a user