[BUGFIX] Support void elements without whitespace in parseFunc 04/36004/3
authorSteffen Müller <typo3@t3node.com>
Tue, 13 Jan 2015 18:11:09 +0000 (19:11 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Thu, 15 Jan 2015 00:35:29 +0000 (01:35 +0100)
xhtml specs require void HTML elements like "<br>" to be
terminated with a "/", for example "<br />".
Whitespaces before the "/" are optional, so tags without
whitespaces are parsed by parseFunc, for example "<br/>"

Resolves: #64267
Releases: master, 6.2
Change-Id: I86a5857b93aeefbc457c309fe4fedd84578ac698
Reviewed-on: http://review.typo3.org/36004
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Frederic Gaus <gaus@flagbit.de>
Tested-by: Frederic Gaus <gaus@flagbit.de>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php

index 33869f7..fd61468 100644 (file)
@@ -4948,7 +4948,12 @@ class ContentObjectRenderer {
                                // tags
                                $len = strcspn(substr($theValue, $pointer), '>') + 1;
                                $data = substr($theValue, $pointer, $len);
-                               $tag = explode(' ', trim(substr($data, 1, -1)), 2);
+                               if (substr($data, -2) === '/>') {
+                                       $tagContent = substr($data, 1, -2);
+                               } else {
+                                       $tagContent = substr($data, 1, -1);
+                               }
+                               $tag = explode(' ', trim($tagContent), 2);
                                $tag[0] = strtolower($tag[0]);
                                if ($tag[0][0] === '/') {
                                        $tag[0] = substr($tag[0], 1);