Fixed Unterminated entity reference when exporting add-ons

pegasus

Well-known member
Affected version
2.0.1
When running cmd.php xf-addon:export
Code:
ErrorException: [E_WARNING] DOMDocument::createElement(): unterminated entity reference ...  src/XF/AddOn/DataType/Option.php:38
Looking at the code for add-on data-types in general, a lot of things which should be escaped are not escaped, and this causes problems when characters like < > & " appear in the node value. Recommend using $doc->createCDATASection before adding content to XML elements.

First noticed this issue in 2.0.1, but updating to 2.0.2 did not resolve the issue.
 
Last edited:
I'm assuming that it was the edit_format upon which the system fell over (please confirm)? What was the actual value that it was trying to use?
 
Nevermind. After running the test again, it appears this has already been fixed in 2.0.2. There must have been a caching issue during my last test run. 2.0.2 converts the value to a text node, which resolves the issue.

For reference, it had been occurring when using the edit_format Radio Buttons option, and including an & in one of the radio options.
 
We have made some further changes here, regardless, so other areas which may have been susceptible to issues should now be encoded as CDATA automatically.
 
Top Bottom