summaryrefslogtreecommitdiff
path: root/inc/SimplePie.php
diff options
context:
space:
mode:
authormichael <michael@content-space.de>2008-12-29 22:33:41 +0100
committermichael <michael@content-space.de>2008-12-29 22:33:41 +0100
commit8285d596bc77e829954be44ccfe8958b1d0387ae (patch)
tree6a7314056c9bdae468460daa84ed523b9e58714b /inc/SimplePie.php
parent8ace41274b7fc9c16a98e5f30d0429724ce0895a (diff)
downloadrpg-8285d596bc77e829954be44ccfe8958b1d0387ae.tar.gz
rpg-8285d596bc77e829954be44ccfe8958b1d0387ae.tar.bz2
Workaround for a PHP/libxml-bug with entities
As described on http://bugs.php.net/bug.php?idE996, current versions of libxml (2.7.0/1) lead to the fact that the xml parser of PHP eats predefined entities. As proposed on http://bugs.simplepie.org/issues/show/101 predefined entities are replaced by their numeric equivalents. There is no condition in this patch as there are people reporting it isn't gone in 2.7.2, i can confirm that, and furthermore here PHP is reporting libxml 20632 and the bug exists, too (it is linked to libxml2 though which has version 2.7.2). As soon as there is definite knowledge on which versions are actually concerned and how to detect them in PHP a condition should be added as this patch might decrease the performance of the affected functions. darcs-hash:20081229213341-074e0-10e0cca836c6599efe4d3dfd45f512d624d0a808.gz
Diffstat (limited to 'inc/SimplePie.php')
-rw-r--r--inc/SimplePie.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/inc/SimplePie.php b/inc/SimplePie.php
index 390b7e0a0..b5dab727f 100644
--- a/inc/SimplePie.php
+++ b/inc/SimplePie.php
@@ -10297,6 +10297,13 @@ class SimplePie_Parser
xml_set_character_data_handler($this->xml, 'cdata');
xml_set_element_handler($this->xml, 'tag_open', 'tag_close');
+ // workound for a bug in PHP/libxml2 as described on http://bugs.simplepie.org/issues/show/101
+ $data = str_replace('&lt;', '&#60;', $data);
+ $data = str_replace('&gt;', '&#62;', $data);
+ $data = str_replace('&amp;', '&#38;', $data);
+ $data = str_replace('&apos;', '&#39;', $data);
+ $data = str_replace('&quot;', '&#34;', $data);
+
// Parse!
if (!xml_parse($this->xml, $data, true))
{