Project

General

Profile

Feature #89389

Updated by Jo Hasenau over 4 years ago

While making use of xml2tree the function xmlRecompileFromStructValArray is involved to "implode an array of XML parts (made with xml_parse_into_struct()) into XML again." 


 If there are opening and closing tags in the same line, the type reported by xml_parse_into_struct is "complete". 
 In this case, there is a check for the content of the given tag and if that is empty, the tag will be made a self closing tag no matter what. 

 <pre><code class="php"> 
 if ($type == 'complete') { 
   if (isset($val['value'])) { 
     $XMLcontent .= '>' . htmlspecialchars($val['value']) . '</' . $val['tag'] . '>'; 
   } else { 
     $XMLcontent .= '/>'; 
   } 
 } 
 </code></pre> 

 This will convert code like 
 <pre><code class="html"> 
 <script type="text/javascript" src="https://some.tld/something.js"></script> 
 </code></pre>to<pre><code class="html"> 
 <script type="text/javascript" src="https://some.tld/something.js"/> 
 </code></pre>which is valid XML but invalid HTML5 and will lead to a broken frontend output. 
 Same for other tags like <span> 

 We found out about this behaviour, because translated HTML content elements were broken after exporting and reimporting them that with the L10nmgr. 
 Still this should be a problem for any other usage of xml2tree dealing with empty tags, that should not be self closing. 

 This is broken in any supported version from CMS 6 up to CMS 10.

Back