aboutsummaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2011-11-16 14:23:06 -0800
committerfriendica <info@friendica.com>2011-11-16 14:23:06 -0800
commitede25aabce2e25ce8134157853ff4c7f45e2f784 (patch)
treee09b84c76b3f27790c7dcaf0fbe54c54e632f130 /library
parentfb8dbfa1bba475a8ee3f622a31c397a7b52cbdcb (diff)
downloadvolse-hubzilla-ede25aabce2e25ce8134157853ff4c7f45e2f784.tar.gz
volse-hubzilla-ede25aabce2e25ce8134157853ff4c7f45e2f784.tar.bz2
volse-hubzilla-ede25aabce2e25ce8134157853ff4c7f45e2f784.zip
check all attribute names for validity
Diffstat (limited to 'library')
-rw-r--r--library/HTML5/TreeBuilder.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/library/HTML5/TreeBuilder.php b/library/HTML5/TreeBuilder.php
index 10d446d1e..578e73682 100644
--- a/library/HTML5/TreeBuilder.php
+++ b/library/HTML5/TreeBuilder.php
@@ -3041,9 +3041,13 @@ class HTML5_TreeBuilder {
if (!empty($token['attr'])) {
foreach($token['attr'] as $attr) {
- // mike@macgirvin.com 2011-10-21, stray double quotes and/or numeric tags cause everything to abort
- $attr['name'] = str_replace('"','',$attr['name']);
- if($attr['name'] && (!$el->hasAttribute($attr['name'])) && (! is_numeric($attr['name']))) {
+
+ // mike@macgirvin.com 2011-11-17, check attribute name for
+ // validity (ignoring extenders and combiners) as illegal chars in names
+ // causes everything to abort
+
+ $valid = preg_match('/^[a-zA-Z\_\:]([\-a-zA-Z0-9\_\:\.]+$)/',$attr['name'],$matches);
+ if($attr['name'] && (!$el->hasAttribute($attr['name'])) && ($valid)) {
$el->setAttribute($attr['name'], $attr['value']);
}
}