From: umherirrender Date: Fri, 31 May 2013 20:18:10 +0000 (+0200) Subject: Do not show empty parenthesis on log entry with no block flags X-Git-Tag: 1.31.0-rc.0~19528^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/journal.php?a=commitdiff_plain;h=2fae2c3d2a9a9013f649b94390354f9e47b15570;p=lhc%2Fweb%2Fwiklou.git 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 --- 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(); } /**