XML Problems with PHP5 and libxml 2.7.1
When using PHP5 with libxml 2.7.1, HTML entities are stripped from any XML content (FCEs, Flexforms, etc) when its saved or retrieved.
For things like RTE content, this means that "<LINK 43>Page with UID 43</LINK>" is not actually transformed into a link but instead renders in the frontend at "LINK 43Page with UID 43/LINK"
This also affects Flexible Content Elements if HTML entities were used for Typoscript assignments, such as "10 < styles.content.get". A previous working FCE and the assignment operator removed and thus renders no content at all.
It remains to be seen how widespread this issue will become or how quickly PHP will patch it, but one helpful option for new sites is to enable the useCDATA option from t3lib_div::array2xml. This will cause TYPO3 to insert CDATA anytime there are html entities within the content. Once CDATA is present, the new content will work as expected.
I'm attaching a one line patch that enables CDATA within flexform XML. There are several other places in the core that also use XML but the flexform part seems to be the most prominent.
(issue imported from #M9359)
#1 Updated by Kai Blaschke about 12 years ago
If you have control over the server's installed software, consider downgrading to libxml2-2.6.32. This workaround solves the problem for the moment, and not only for TYPO3, as other projects may be affected, too.
As stated in the bugs linked above, the problem lies deep inside the XML extension of PHP, and needs to be addressed carefully, including some heavy rewriting of the extension core. This usually takes a while until it's included in a new release, and since then, it's better to stick with an older libxml2 version IMHO.
#3 Updated by Tobias Liebig almost 12 years ago
Yesterday i stumpled over exactly this problem, after our hoster updated some libs on the system.
i spend a couple of hours debugging the issue and solved it exactly like jeff does in his patch.
Its true: it only solves the issue for flexforms, but not for any other cases where xml2array/xml_parse_into_struct w/o CDATA is used.
For me i would vote +1 for commiting the patch into the core, as it would fix the bug for now and does not break if PHP/libxml solves the problem afterwards. Thus its not a hack/workaround in a sense of "fixing php-bugs" as steffen mentioned.
@jeff: Go for a RFC and we will see what the other core-dev think about it.
#4 Updated by Tobias Liebig almost 12 years ago
i have prepared a minimal example demonstrating the PHP-Bug
$simple = "<root><node><strong>Teststring</strong></node></root>";
$p = xml_parser_create();
xml_parse_into_struct($p, $simple, $vals, $index);
wrong output (PHP5.2.6/libxml 2.7.1)