From: Andrew Dolgov Date: Mon, 25 Mar 2013 05:17:14 +0000 (+0400) Subject: tweak strip_harmful_tags() for php 5.3.2 compatibility (refs #620) X-Git-Tag: 1.7.6~316 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=5f0081b05bac2d12fe2d24e385bffc53daabeb5f;p=tt-rss.git tweak strip_harmful_tags() for php 5.3.2 compatibility (refs #620) --- diff --git a/include/functions.php b/include/functions.php index 962ebb05..5582c2b0 100644 --- a/include/functions.php +++ b/include/functions.php @@ -2685,16 +2685,22 @@ } if ($entry->hasAttributes()) { - foreach (iterator_to_array($entry->attributes) as $attr) { + $attrs_to_remove = array(); + + foreach ($entry->attributes as $attr) { if (strpos($attr->nodeName, 'on') === 0) { - $entry->removeAttributeNode($attr); + array_push($attrs_to_remove, $attr); } if (in_array($attr->nodeName, $disallowed_attributes)) { - $entry->removeAttributeNode($attr); + array_push($attrs_to_remove, $attr); } } + + foreach ($attrs_to_remove as $attr) { + $entry->removeAttributeNode($attr); + } } }