summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-03-25 09:17:14 +0400
committerAndrew Dolgov <[email protected]>2013-03-25 09:17:16 +0400
commit5f0081b05bac2d12fe2d24e385bffc53daabeb5f (patch)
treeff1b5e53607253fde950c7d43519e97761eb783b /include
parent998bfad3488de3ca02c2f991fc8aea6ab80feea1 (diff)
tweak strip_harmful_tags() for php 5.3.2 compatibility (refs #620)
Diffstat (limited to 'include')
-rw-r--r--include/functions.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/functions.php b/include/functions.php
index 962ebb057..5582c2b0b 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);
+ }
}
}