Do not show empty parenthesis on log entry with no block flags

When nothing is stored in the database, the explode in
LogPage::formatBlockFlags will explode a empty string to a array with a
empty string as only value. Changed the count(array) check to empty
string check.

Bug: 47035
Change-Id: I879169599a2a24b35e26d4a23ab8202f267d8b00
This commit is contained in:
umherirrender 2013-05-31 22:18:10 +02:00
parent f8ba647478
commit 2fae2c3d2a

View file

@ -518,17 +518,17 @@ class LogPage {
* @return String
*/
public static function formatBlockFlags( $flags, $lang ) {
$flags = explode( ',', trim( $flags ) );
if ( count( $flags ) > 0 ) {
for ( $i = 0; $i < count( $flags ); $i++ ) {
$flags[$i] = self::formatBlockFlag( $flags[$i], $lang );
}
return wfMessage( 'parentheses' )->inLanguage( $lang )
->rawParams( $lang->commaList( $flags ) )->escaped();
} else {
return '';
$flags = trim( $flags );
if ( $flags === '' ) {
return ''; //nothing to do
}
$flags = explode( ',', $flags );
for ( $i = 0; $i < count( $flags ); $i++ ) {
$flags[$i] = self::formatBlockFlag( $flags[$i], $lang );
}
return wfMessage( 'parentheses' )->inLanguage( $lang )
->rawParams( $lang->commaList( $flags ) )->escaped();
}
/**