]> git.wh0rd.org Git - tt-rss.git/commitdiff
tweak strip_harmful_tags() for php 5.3.2 compatibility (refs #620)
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 25 Mar 2013 05:17:14 +0000 (09:17 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 25 Mar 2013 05:17:16 +0000 (09:17 +0400)
include/functions.php

index 962ebb057c3f953616ddde16ca1894900e17e839..5582c2b0b0a177b3120c8f6b4f7d92797e18ff6c 100644 (file)
                        }
 
                        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);
+                               }
                        }
                }