You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In your dataobject when you use the 'htmltext' db field type the corresponding htmleditorfield class calls saveInto which passes the value to the HTMLValue class. Its constructor calls setContent which does a preg_replace on the html content and if you have any <header> tags in your content, it gets stripped out by the regex preg_replace.
Module version(s) affected
5.2.0
Description
In your dataobject when you use the 'htmltext' db field type the corresponding htmleditorfield class calls saveInto which passes the value to the HTMLValue class. Its constructor calls setContent which does a preg_replace on the html content and if you have any
<header>
tags in your content, it gets stripped out by the regex preg_replace.How to reproduce
HTMLEditorConfig::get('cms')->setOption('extended_valid_elements', 'header[class|data|id],');
// Make sure the editor itself doesn't strip out tagsPossible Solution
replace
$content = preg_replace('#</?(html|head|body)[^>]*>#si', '', $content);
with
$content = preg_replace('#</?(html|head(?!er)|body)[^>]*>#si', '', $content);
or a regex that accomplishes the same result
Additional Context
No response
Validations
silverstripe/installer
(with any code examples you've provided)PRs
<header>
tag fromHTMLValue
#11302The text was updated successfully, but these errors were encountered: