Normally the user is not allowed to publish a fragment with invalid html, 1) to prevent risks of breaking content pages and 2) because it makes no sense for them to intentionally publish a fragment with invalid html, so we help them by disallowing the publish. While we can currently check if a freemarker syntax is valid or not, we do not deny the user from publishing a fragment with invalid freemarker syntax.
Prevention in future
We should cover this in an integration test as well.
Example of invalid freemarker for a fragment
Steps to Reproduce
- Create a fragment with invalid freemarker syntax
- Publish fragment
User is given a useful error telling them the freemarker syntax is invalid, possibly using liferay-ui:error taglib
User is allowed to publish the invalid fragment
Tested on Tomcat 9.0.17 + MySQL 5.7
Portal master GIT ID: 177cf7b77e50603caa150ad069c639c759381a0d