This escaping is not used anywhere

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
Kamil Tekiela 2023-12-01 17:49:59 +01:00
parent aad5bd7d22
commit a2f13a8cd2
3 changed files with 2 additions and 19 deletions

View File

@ -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);
}
/**

View File

@ -165,10 +165,9 @@ class Sanitize
* <a title="<?php echo Sanitize::sanitizeMessage($foo, true); ?>">bar</a>
*
* @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, ['<' => '&lt;', '>' => '&gt;']);
@ -220,11 +219,6 @@ class Sanitize
$message,
);
/* Possibly escape result */
if ($escape) {
return htmlspecialchars($message);
}
return $message;
}

View File

@ -139,17 +139,6 @@ class SanitizeTest extends AbstractTestCase
);
}
/**
* Tests output escaping.
*/
public function testEscape(): void
{
$this->assertEquals(
'&lt;strong&gt;strong&lt;/strong&gt;',
Sanitize::sanitizeMessage('[strong]strong[/strong]', true),
);
}
/**
* Test for Sanitize::sanitizeFilename
*/