Skip to content
Browse files

If DOMDocument doesn't exist, nicely fail Sanitize

See #241. This fixes it for 1.3.2, but requires different changes for 1.4.
  • Loading branch information...
1 parent 38eac68 commit 16160017bf904538c3fe4cacadc1aba19d445106 @rmccue rmccue committed Dec 2, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 library/SimplePie/Sanitize.php
View
5 library/SimplePie/Sanitize.php
@@ -247,6 +247,11 @@ public function sanitize($data, $type, $base = '')
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);

0 comments on commit 1616001

Please sign in to comment.
Something went wrong with that request. Please try again.