diff --git a/src/Message.php b/src/Message.php index 0282dc60cf..a531629e57 100644 --- a/src/Message.php +++ b/src/Message.php @@ -472,7 +472,7 @@ class Message implements Stringable */ public static function decodeBB(string $message): string { - return Sanitize::sanitizeMessage($message, false, true); + return Sanitize::sanitizeMessage($message, true); } /** diff --git a/src/Sanitize.php b/src/Sanitize.php index f110bf90f0..40f8f8ed2e 100644 --- a/src/Sanitize.php +++ b/src/Sanitize.php @@ -165,10 +165,9 @@ class Sanitize * bar * * @param string $message the message - * @param bool $escape whether to escape html in result * @param bool $safe whether string is safe (can keep < and > chars) */ - public static function sanitizeMessage(string $message, bool $escape = false, bool $safe = false): string + public static function sanitizeMessage(string $message, bool $safe = false): string { if (! $safe) { $message = strtr($message, ['<' => '<', '>' => '>']); @@ -220,11 +219,6 @@ class Sanitize $message, ); - /* Possibly escape result */ - if ($escape) { - return htmlspecialchars($message); - } - return $message; } diff --git a/tests/classes/SanitizeTest.php b/tests/classes/SanitizeTest.php index be782d3bdf..59f17a3926 100644 --- a/tests/classes/SanitizeTest.php +++ b/tests/classes/SanitizeTest.php @@ -139,17 +139,6 @@ class SanitizeTest extends AbstractTestCase ); } - /** - * Tests output escaping. - */ - public function testEscape(): void - { - $this->assertEquals( - '<strong>strong</strong>', - Sanitize::sanitizeMessage('[strong]strong[/strong]', true), - ); - } - /** * Test for Sanitize::sanitizeFilename */