http://forge.typo3.org/http://forge.typo3.org/themes/typo3_forge/favicon/favicon.png?17058661692018-07-24T20:52:39ZTYPO3 ForgeTYPO3 Core - Bug #85635: Broken <script> tag after XML importhttp://forge.typo3.org/issues/85635?journal_id=3693542018-07-24T20:52:39ZCoders.Care Extension Teamextensions@coders.care
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Needs Feedback</i></li></ul><p>Could you please check your file again to find out if there is any <![CDATA[]]> surrounding your HTML code?<br />Actually this seems to make a difference at least on our testing system, since exactly your HTML-Code will be imported unchanged with CDATA but as a closed tag without it.</p> TYPO3 Core - Bug #85635: Broken <script> tag after XML importhttp://forge.typo3.org/issues/85635?journal_id=3693552018-07-24T21:13:53ZCoders.Care Extension Teamextensions@coders.care
<ul></ul><p>It seems to be a core bug, since the CatXmlImportManager uses</p>
<p>GeneralUtility::xml2tree</p>
<p>to transform the XML code.</p>
<p>That again uses xmlRecompileFromStructValArray to implode array structures back into XML.</p>
<p>If there is no value, this method automatically closes any opening tag into a self closing tag instead of using a closing tag for tags that are not allowed to be self closing.<br />If the type is detected as "cdata" the whole value is just added as is, which is why CDATA works.<br /><pre>
/**
* This implodes an array of XML parts (made with xml_parse_into_struct()) into XML again.
*
* @param array $vals An array of XML parts, see xml2tree
* @return string Re-compiled XML data.
*/
public static function xmlRecompileFromStructValArray(array $vals)
{
$XMLcontent = '';
foreach ($vals as $val) {
$type = $val['type'];
// Open tag:
if ($type === 'open' || $type === 'complete') {
$XMLcontent .= '<' . $val['tag'];
if (isset($val['attributes'])) {
foreach ($val['attributes'] as $k => $v) {
$XMLcontent .= ' ' . $k . '="' . htmlspecialchars($v) . '"';
}
}
if ($type === 'complete') {
if (isset($val['value'])) {
$XMLcontent .= '>' . htmlspecialchars($val['value']) . '</' . $val['tag'] . '>';
} else {
$XMLcontent .= '/>';
}
} else {
$XMLcontent .= '>';
}
if ($type === 'open' && isset($val['value'])) {
$XMLcontent .= htmlspecialchars($val['value']);
}
}
// Finish tag:
if ($type === 'close') {
$XMLcontent .= '</' . $val['tag'] . '>';
}
// Cdata
if ($type === 'cdata') {
$XMLcontent .= htmlspecialchars($val['value']);
}
}
return $XMLcontent;
}
</pre></p>
<p>To get a better understanding of the types "open", "complete" and "close", see<br /><a class="external" href="http://php.net/manual/de/function.xml-parse-into-struct.php">http://php.net/manual/de/function.xml-parse-into-struct.php</a></p> TYPO3 Core - Bug #85635: Broken <script> tag after XML importhttp://forge.typo3.org/issues/85635?journal_id=3693562018-07-24T21:18:23ZCoders.Care Extension Teamextensions@coders.care
<ul><li><strong>Project</strong> changed from <i>240</i> to <i>TYPO3 Core</i></li><li><strong>Description</strong> updated (<a title="View differences" href="/journals/369356/diff?detail_id=308523">diff</a>)</li><li><strong>Category</strong> changed from <i>1636</i> to <i>Miscellaneous</i></li><li><strong>Assignee</strong> deleted (<del><i>Jo Hasenau</i></del>)</li><li><strong>Target version</strong> changed from <i>3461</i> to <i>next-patchlevel</i></li><li><strong>PHP Version</strong> set to <i>7.0</i></li></ul> TYPO3 Core - Bug #85635: Broken <script> tag after XML importhttp://forge.typo3.org/issues/85635?journal_id=3693572018-07-24T21:19:28ZCoders.Care Extension Teamextensions@coders.care
<ul></ul><p>Since the method is quite old, I guess this happens with CMS 6 and 7 as well.</p> TYPO3 Core - Bug #85635: Broken <script> tag after XML importhttp://forge.typo3.org/issues/85635?journal_id=3693582018-07-24T21:25:04ZCoders.Care Extension Teamextensions@coders.care
<ul></ul><p>According to HTML5 specs, the following tags are allowed to be "void" and therefor self closing.<br /><pre>
area, base, br, col, embed, hr, img, input, keygen, link, meta, param, source, track, wbr
</pre>Any other tag has to get a closing tag to produce valid HTML5.</p> TYPO3 Core - Bug #85635: Broken <script> tag after XML importhttp://forge.typo3.org/issues/85635?journal_id=3694052018-07-25T16:42:11ZDmitry no-lastname-givenpulsarx58@gmail.com
<ul></ul><p>Coders.Care Extension Team wrote:</p>
<blockquote>
<p>Could you please check your file again to find out if there is any <![CDATA[]]> surrounding your HTML code?<br />Actually this seems to make a difference at least on our testing system, since exactly your HTML-Code will be imported unchanged with CDATA but as a closed tag without it.</p>
</blockquote>
<p>Hi,<br />Just checked - no, block with script tag is not wrapped with CDATA. Weird, I have 20 translated bodytext fields in file, but only 4 of them are wrapped in CDATA.</p> TYPO3 Core - Bug #85635: Broken <script> tag after XML importhttp://forge.typo3.org/issues/85635?journal_id=3694382018-07-26T11:20:00ZCoders.Care Extension Teamextensions@coders.care
<ul><li><strong>Assignee</strong> set to <i>Jo Hasenau</i></li></ul><p>As a workaround you can check the checkbox "Do not check XML" - this automatically wraps content with CDATA to make sure it does not break the XML parser. Still this is just a workaround for the L10nmgr but the bug in xmlRecompileFromStructValArray should be fixed anyway.</p> TYPO3 Core - Bug #85635: Broken <script> tag after XML importhttp://forge.typo3.org/issues/85635?journal_id=3699642018-08-02T20:16:19ZDmitry no-lastname-givenpulsarx58@gmail.com
<ul></ul><p>Coders.Care Extension Team wrote:</p>
<blockquote>
<p>As a workaround you can check the checkbox "Do not check XML" - this automatically wraps content with CDATA to make sure it does not break the XML parser. Still this is just a workaround for the L10nmgr but the bug in xmlRecompileFromStructValArray should be fixed anyway.</p>
</blockquote>
<p>It's already checked. If I don't check it - export fails.</p> TYPO3 Core - Bug #85635: Broken <script> tag after XML importhttp://forge.typo3.org/issues/85635?journal_id=3984422019-04-17T23:42:32ZBenni Mackbenni@typo3.org
<ul><li><strong>Target version</strong> changed from <i>next-patchlevel</i> to <i>Candidate for patchlevel</i></li></ul> TYPO3 Core - Bug #85635: Broken <script> tag after XML importhttp://forge.typo3.org/issues/85635?journal_id=4202712020-03-24T16:59:56ZSusanne Moogsusanne.moog@typo3.org
<ul></ul><p>Can somebody summarize what the core bug here is and what needs fixing exactly?</p> TYPO3 Core - Bug #85635: Broken <script> tag after XML importhttp://forge.typo3.org/issues/85635?journal_id=4645062022-02-19T12:49:21ZChristian Kuhnlolli@schwarzbu.ch
<ul><li><strong>Status</strong> changed from <i>Needs Feedback</i> to <i>Closed</i></li></ul><p>Hey. It is quite hard to understand what the real issue is in this case. A request from Susi to clearify has not been answered. At the moment I see no other solution than to close this issue for now. If the problem persists, we should probably start with a fresh issue describing the problem again.</p>