diff --git a/NEWS b/NEWS index bbd02f0f..fa4380c7 100644 --- a/NEWS +++ b/NEWS @@ -66,6 +66,7 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier - Will now throw exception on many error conditions during lexer creation; also throw an exception when MaintainLineNumbers is true, but a non-tracksLineNumbers is being used. +- Detect if domxml extension is loaded, and use DirectLEx accordingly. . 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 f6e5a90b..043c0ea0 100644 --- a/library/HTMLPurifier/Lexer.php +++ b/library/HTMLPurifier/Lexer.php @@ -93,9 +93,15 @@ class HTMLPurifier_Lexer break; } - if (class_exists('DOMDocument') && method_exists('DOMDocument', 'loadHTML')) { - // check for DOM support, because, surprisingly enough, - // it's *not* part of the core! + if ( + class_exists('DOMDocument') && + method_exists('DOMDocument', 'loadHTML') && + !extension_loaded('domxml') + ) { + // check for DOM support, because while it's part of the + // core, it can be disabled compile time. Also, the PECL + // domxml extension overrides the default DOM, and is evil + // and nasty and we shan't bother to support it $lexer = 'DOMLex'; } else { $lexer = 'DirectLex'; diff --git a/tests/HTMLPurifier/PHPT/domxml.phpt b/tests/HTMLPurifier/PHPT/domxml.phpt new file mode 100644 index 00000000..2cdd41b7 --- /dev/null +++ b/tests/HTMLPurifier/PHPT/domxml.phpt @@ -0,0 +1,15 @@ +--TEST-- +DirectLex with domxml test +--SKIPIF-- +