From 2fae2c3d2a9a9013f649b94390354f9e47b15570 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 31 May 2013 22:18:10 +0200 Subject: [PATCH] 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 --- includes/logging/LogPage.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/logging/LogPage.php b/includes/logging/LogPage.php index 9d6ab25bbd..521cb8a48f 100644 --- a/includes/logging/LogPage.php +++ b/includes/logging/LogPage.php @@ -518,17 +518,17 @@ class LogPage { * @return String */ public static function formatBlockFlags( $flags, $lang ) { - $flags = explode( ',', trim( $flags ) ); + $flags = trim( $flags ); + if ( $flags === '' ) { + return ''; //nothing to do + } + $flags = explode( ',', $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 ''; + for ( $i = 0; $i < count( $flags ); $i++ ) { + $flags[$i] = self::formatBlockFlag( $flags[$i], $lang ); } + return wfMessage( 'parentheses' )->inLanguage( $lang ) + ->rawParams( $lang->commaList( $flags ) )->escaped(); } /** -- 2.20.1