Skip to content

Prevent setting text as HTML in Text#2043

Merged
mvorisek merged 9 commits intodevelopfrom
text_dangerous_html
Nov 27, 2024
Merged

Prevent setting text as HTML in Text#2043
mvorisek merged 9 commits intodevelopfrom
text_dangerous_html

Conversation

@mvorisek
Copy link
Copy Markdown
Member

fix #2040

@mvorisek mvorisek force-pushed the text_dangerous_html branch 3 times, most recently from 32dddf5 to 7f97285 Compare September 7, 2023 11:24
@mvorisek mvorisek force-pushed the text_dangerous_html branch from 7f97285 to df37eea Compare November 27, 2024 00:15
@mvorisek mvorisek force-pushed the text_dangerous_html branch from df37eea to f1c7e12 Compare November 27, 2024 12:09
@mvorisek mvorisek force-pushed the text_dangerous_html branch from 39291b8 to 57e32f1 Compare November 27, 2024 14:00
@mvorisek mvorisek force-pushed the text_dangerous_html branch from 50a4b2e to cf19e62 Compare November 27, 2024 15:37
@mvorisek mvorisek force-pushed the text_dangerous_html branch from cf19e62 to ec8e01b Compare November 27, 2024 15:38
@mvorisek mvorisek marked this pull request as ready for review November 27, 2024 15:56
Copy link
Copy Markdown
Member

@DarkSide666 DarkSide666 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

src/Text.php Outdated
$this->content .= $this->getApp()->getTag('p', [], $text);
$this->content[] = (new HtmlValue())->dangerouslySetHtml('<p>');
$this->content[] = (new HtmlValue())->set($text);
$this->content[] = (new HtmlValue())->dangerouslySetHtml('</p>');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here you could simply use $this->dangerouslyAddHtml('</p>');, but that's additional function call, so probably better not.

@mvorisek mvorisek merged commit 78b7fd5 into develop Nov 27, 2024
@mvorisek mvorisek deleted the text_dangerous_html branch November 27, 2024 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

HTML text can be passed easily to Text

2 participants