Skip to content

Commit

Permalink
If DOMDocument doesn't exist, nicely fail Sanitize
Browse files Browse the repository at this point in the history
See #241. This fixes it for 1.3.2, but requires different changes for 1.4.
  • Loading branch information
rmccue committed Dec 2, 2012
1 parent 38eac68 commit 1616001
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions library/SimplePie/Sanitize.php
Expand Up @@ -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);
Expand Down

0 comments on commit 1616001

Please sign in to comment.