Repository navigation
Conversation
The template wrapped every line in its own paragraph without escaping it, so user-supplied text was inserted as markup, blank lines became empty paragraphs and CRLF input left carriage returns behind. Treat $content as plain text: escape each line, separate paragraphs by blank lines and turn single line breaks into <br>. Restrict \R to CR and LF so that the UTF-8 byte 0x85 in characters such as "Å" is not taken as a line break. Fixes cakephp#1115
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1115.
As agreed in the issue,
$contentis treated as plain text, the same string thattext/default.phpechoes.h().<br>, so hard-wrapped text stays in one paragraph like in the text part.\r\nand\r, and render no empty paragraphs.(*BSR_ANYCRLF)in the patterns proposed in the issue: without theumodifier,\Ralso matches the byte0x85, which occurs inside UTF-8 characters such as "Å". Addinguinstead would makepreg_split()fail on invalid UTF-8 and drop the content.DefaultTemplateTestcovering paragraphs, escaping, multibyte characters and empty content.