[BUGFIX] Keep hyphens in custom HTML5 attributes 63/9563/2
authorJigal van Hemert <jigal@xs4all.nl>
Fri, 9 Mar 2012 19:52:39 +0000 (20:52 +0100)
committerOliver Hader <oliver.hader@typo3.org>
Fri, 1 Mar 2013 12:36:48 +0000 (13:36 +0100)
In frontend rendering hyphens in custom attribute names must be kept.
Use the same regexp as in t3lib_parsehtml keeps allowed special
characters.

Change-Id: I6253f1c4c0a14389fc6261c62752e41f9ddb66f9
Releases: 4.8, 4.7, 4.6, 4.5
Fixes: #34371
Reviewed-on: https://review.typo3.org/9563
Reviewed-by: Steffen Ritter
Reviewed-by: Philipp Gampe
Reviewed-by: Mario Rimann
Reviewed-by: Stefan Neufeind
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
t3lib/class.t3lib_div.php

index 425803c..b18c8d8 100644 (file)
@@ -2379,7 +2379,7 @@ final class t3lib_div {
                                                $name = '';
                                        }
                                } else {
-                                       if ($key = strtolower(preg_replace('/[^a-zA-Z0-9]/', '', $val))) {
+                                       if ($key = strtolower(preg_replace('/[^[:alnum:]_\:\-]/', '', $val))) {
                                                $attributes[$key] = '';
                                                $name = $key;
                                        }