[BUGFIX] HTMLParser doesn't remove endtag when applying rmTagIfNoAttrib
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Html / HtmlParser.php
index de8cada..09237af 100644 (file)
@@ -1356,6 +1356,9 @@ class HtmlParser {
                                        }
                                        unset($tagC['fixAttrib.']);
                                        unset($tagC['fixAttrib']);
+                                       if (isset($tagC['rmTagIfNoAttrib']) && $tagC['rmTagIfNoAttrib'] && empty($tagC['nesting'])) {
+                                               $tagC['nesting'] = 1;
+                                       }
                                        $keepTags[$key] = array_merge($keepTags[$key], $tagC);
                                }
                        }
@@ -1365,6 +1368,9 @@ class HtmlParser {
                        $lN = GeneralUtility::trimExplode(',', strtolower($TSconfig['localNesting']), TRUE);
                        foreach ($lN as $tn) {
                                if (isset($keepTags[$tn])) {
+                                       if (!is_array($keepTags[$tn])) {
+                                               $keepTags[$tn] = array();
+                                       }
                                        $keepTags[$tn]['nesting'] = 1;
                                }
                        }
@@ -1388,6 +1394,9 @@ class HtmlParser {
                                                $keepTags[$tn] = array();
                                        }
                                        $keepTags[$tn]['rmTagIfNoAttrib'] = 1;
+                                       if (empty($keepTags[$tn]['nesting'])) {
+                                               $keepTags[$tn]['nesting'] = 1;
+                                       }
                                }
                        }
                }