Please sign in to comment.
BUG HtmlEditorField doesn't save HTML fragments in HTMLValue correctly
The issue was raised in #7628, where an anchor tag was being changed from <a name="anchor"></a> to <a name="anchor"/> by SS_HTMLValue, when HtmlEditorField::saveInto() parses the HTML fragments. This is because SS_HTMLValue uses DOMDocument::saveXML(), which is fine for saving an XML document, but not suitable for HTML. This fix changes that to use DOMDocument::saveHTML() instead. Note that we can't use the parameter to saveHTML() for selecting a single node only, as that's only supported in PHP 5.3.6+, SilverStripe 3.0 supports PHP 5.3.2 as a minimum. The workaround for this shortcoming is to replace unncessary output by DOMDocument with a regular expression.
- Loading branch information...
Showing with 35 additions and 30 deletions.