Merge "Sanitizer::normalizeSectionNameWhitespace: Apply same anti-null fix as 270499b" into REL1_43
This commit is contained in:
commit
f6686ed028
1 changed files with 7 additions and 2 deletions
|
|
@ -1139,7 +1139,7 @@ class Sanitizer {
|
|||
$normalized = preg_replace( '/(?:\r\n|[\x20\x0d\x0a\x09])+/', ' ', $text );
|
||||
if ( $normalized === null ) {
|
||||
wfLogWarning( __METHOD__ . ': Failed to normalize whitespace: ' . preg_last_error() );
|
||||
return "";
|
||||
return '';
|
||||
}
|
||||
return trim( $normalized );
|
||||
}
|
||||
|
|
@ -1150,7 +1150,12 @@ class Sanitizer {
|
|||
* section links.
|
||||
*/
|
||||
public static function normalizeSectionNameWhitespace( string $section ): string {
|
||||
return trim( preg_replace( '/[ _]+/', ' ', $section ) );
|
||||
$normalized = preg_replace( '/[ _]+/', ' ', $section );
|
||||
if ( $normalized === null ) {
|
||||
wfLogWarning( __METHOD__ . ': Failed to normalize whitespace: ' . preg_last_error() );
|
||||
return '';
|
||||
}
|
||||
return trim( $normalized );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue