From f2b9e1a090c4dadfd54546bf647becbe0d4927fb Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Sun, 2 Dec 2012 16:43:12 +0000 Subject: [PATCH] SimplePie: Return nothing and throw an error in SimplePie_Sanitize when DOMDocument is disabled. Note that when SimplePie is used through the WordPress fetch_feed() function, we use kses rather than SimplePie_Sanitize, which removes the dependency on DOMDocument. This change is only for plugins using SimplePie directly. props rmccue. fixes #21990. git-svn-id: https://develop.svn.wordpress.org/trunk@22970 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/SimplePie/Sanitize.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wp-includes/SimplePie/Sanitize.php b/wp-includes/SimplePie/Sanitize.php index 6810cc49ff..442e8e219c 100644 --- a/wp-includes/SimplePie/Sanitize.php +++ b/wp-includes/SimplePie/Sanitize.php @@ -247,6 +247,11 @@ class SimplePie_Sanitize if ($type & (SIMPLEPIE_CONSTRUCT_HTML | SIMPLEPIE_CONSTRUCT_XHTML)) { + if (!class_exists('DOMDocument')) + { + $this->registry->call('Misc', 'error', array('DOMDocument not found, unable to use sanitizer', E_USER_WARNING, __FILE__, __LINE__)); + return ''; + } $document = new DOMDocument(); $document->encoding = 'UTF-8'; $data = $this->preprocess($data, $type);