From 484c34a93e0ce6b1be47c36f475bd0bd8bfc099e Mon Sep 17 00:00:00 2001 From: aheart Date: Tue, 22 Sep 2020 20:44:14 +0300 Subject: [PATCH] Filter selected text to prevent invalid XML (#4234) --- src/Psalm/Report/JunitReport.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Psalm/Report/JunitReport.php b/src/Psalm/Report/JunitReport.php index b5cf31fbd4c..e80649f373f 100644 --- a/src/Psalm/Report/JunitReport.php +++ b/src/Psalm/Report/JunitReport.php @@ -168,7 +168,7 @@ private function dataToOutput(IssueData $data): string $ret = 'message: ' . htmlspecialchars(trim($data->message), ENT_XML1 | ENT_QUOTES) . "\n"; $ret .= 'type: ' . trim($data->type) . "\n"; $ret .= 'snippet: ' . htmlspecialchars(trim($data->snippet), ENT_XML1 | ENT_QUOTES) . "\n"; - $ret .= 'selected_text: ' . trim($data->selected_text) . "\n"; + $ret .= 'selected_text: ' . htmlspecialchars(trim($data->selected_text)) . "\n"; $ret .= 'line: ' . $data->line_from . "\n"; $ret .= 'column_from: ' . $data->column_from . "\n"; $ret .= 'column_to: ' . $data->column_to . "\n";