From 0423985b45c1d96e718cc56641c81709d14808ac Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Thu, 7 Aug 2008 18:44:21 -0400 Subject: [PATCH] Detect if HTML support in DOM is disabled by checking loadHTML(). Signed-off-by: Edward Z. Yang --- NEWS | 1 + library/HTMLPurifier/Lexer.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 4f1c09e5..fc69ea47 100644 --- a/NEWS +++ b/NEWS @@ -38,6 +38,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier - Fix error in documentation regarding %Filter.ExtractStyleBlocks - Prevent ]]> from triggering %Core.ConvertDocumentToFragment - Fix bug with inline elements in blockquotes conflicting with strict doctype +- Detect if HTML support is disabled for DOM by checking for loadHTML() method. . Strategy_MakeWellFormed now operates in-place, saving memory and allowing for more interesting filter-backtracking . New HTMLPurifier_Injector->rewind() functionality, allows injectors to rewind diff --git a/library/HTMLPurifier/Lexer.php b/library/HTMLPurifier/Lexer.php index 8c60ab33..03fe032f 100644 --- a/library/HTMLPurifier/Lexer.php +++ b/library/HTMLPurifier/Lexer.php @@ -88,7 +88,7 @@ class HTMLPurifier_Lexer break; } - if (class_exists('DOMDocument')) { + if (class_exists('DOMDocument') && method_exists('DOMDocument', 'loadHTML')) { // check for DOM support, because, surprisingly enough, // it's *not* part of the core! $lexer = 'DOMLex';