From 886647d1caf7181e947a2e771600d1addfaf53ac Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 24 Nov 2014 12:23:38 +0100 Subject: update zendxml --- articleenhancer/xpatharticleenhancer.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'articleenhancer/xpatharticleenhancer.php') diff --git a/articleenhancer/xpatharticleenhancer.php b/articleenhancer/xpatharticleenhancer.php index 871752856..aa94eec54 100644 --- a/articleenhancer/xpatharticleenhancer.php +++ b/articleenhancer/xpatharticleenhancer.php @@ -70,9 +70,7 @@ class XPathArticleEnhancer implements ArticleEnhancer { $dom = new DOMDocument(); - Security::scan($body, $dom, function ($xml, $dom) { - return @$dom->loadHTML($xml, LIBXML_NONET); - }); + $isOk = Security::scanHtml($body, $dom); $xpath = new DOMXpath($dom); $xpathResult = $xpath->evaluate($search); @@ -121,14 +119,16 @@ class XPathArticleEnhancer implements ArticleEnhancer { $dom = new DOMDocument(); $dom->preserveWhiteSpace = false; - $isOk = Security::scan($xmlString, $dom, function ($xml, $dom) { - // wrap in div to prevent loadHTML from inserting weird elements - $xml = '
' . $xml . '
'; - return @$dom->loadHTML($xml, LIBXML_NONET | LIBXML_HTML_NODEFDTD - | LIBXML_HTML_NOIMPLIED); - }); + if($xmlString === '') { + return false; + } + + $xmlString = '
' . $xmlString . '
'; + $isOk = Security::scanHtml( + $xmlString, $dom, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD + ); - if($xmlString === '' || !$isOk) { + if(!$isOk) { return false; } -- cgit v1.2.3