Sanitizer::normalizeWhitespace: simplify redundant preg_replace
The extraneous sequence \r\n is not required. Avoid the use of hexcode to avoid future confusions. Bug: T388733 Change-Id: I1092ff76ed5e8221e43ea7b70cf0c9d9d3abb1f3 (cherry picked from commit 6753123a0629de81ce4899958180272736e7ba61)
This commit is contained in:
parent
dccd645af7
commit
0f921b7878
1 changed files with 1 additions and 1 deletions
|
|
@ -1136,7 +1136,7 @@ class Sanitizer {
|
|||
}
|
||||
|
||||
private static function normalizeWhitespace( string $text ): string {
|
||||
$normalized = preg_replace( '/(?:\r\n|[\x20\x0d\x0a\x09])+/', ' ', $text );
|
||||
$normalized = preg_replace( '/[ \r\n\t]+/', ' ', $text );
|
||||
if ( $normalized === null ) {
|
||||
wfLogWarning( __METHOD__ . ': Failed to normalize whitespace: ' . preg_last_error() );
|
||||
return '';
|
||||
|
|
|
|||
Loading…
Reference in a new issue