From 815e12f8731453fce48628ce0cdd3177c3f2abf7 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Mon, 5 Oct 2009 00:59:40 +0000 Subject: handle bad xml --- it_xml.class | 3 +++ 1 file changed, 3 insertions(+) (limited to 'it_xml.class') diff --git a/it_xml.class b/it_xml.class index 654042b..6013b52 100644 --- a/it_xml.class +++ b/it_xml.class @@ -88,6 +88,9 @@ function from_xml($xmldata, $p) if (!preg_match('/^(<\?xml|\xEF\xBB\xBF|\xFE\xFF|\xFF\xFE|\x00\x00\xFE\xFF|\x00\x00\xFF\xFE)/', $xmldata)) $xmldata = '_p['encoding'] . '"?>' . $xmldata; + # decode illegal entities but protect semantically important ones + $xmldata = html_entity_decode(preg_replace('/&(amp|lt|gt|#38|#60|#62|#x26|#x3C|#3E);/i', '&$1;', $xmldata)); + $result = xml_parse($parser, $xmldata); } -- cgit v1.2.3