From: Matthias Mullie Date: Wed, 23 Sep 2015 11:24:34 +0000 (+0200) Subject: Don't attempt to render block if none of the lines can be shown X-Git-Tag: 1.31.0-rc.0~9862^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/Category:Foo?a=commitdiff_plain;h=c9fedd8fc0c752a7dc3b4b9d2fc292efb4ff917c;p=lhc%2Fweb%2Fwiklou.git Don't attempt to render block if none of the lines can be shown Not only doesn't it make sense to render this, getLogText has some assumptions about this array, and an empty array just didn't work. Bug: T112738 Change-Id: Ibdc0c4ed15449883a91a3292bfa174ff84116be0 --- diff --git a/includes/changes/EnhancedChangesList.php b/includes/changes/EnhancedChangesList.php index d912e3a2dd..1dcb7aef48 100644 --- a/includes/changes/EnhancedChangesList.php +++ b/includes/changes/EnhancedChangesList.php @@ -283,6 +283,10 @@ class EnhancedChangesList extends ChangesList { // Further down are some assumptions that $block is a 0-indexed array // with (count-1) as last key. Let's make sure it is. $block = array_values( $block ); + if ( empty( $block ) ) { + // if we can't show anything, don't display this block altogether + return ''; + } $r .= $this->getLogText( $block, $queryParams, $allLogs, $isnew, $namehidden ); @@ -453,6 +457,10 @@ class EnhancedChangesList extends ChangesList { * @return string */ protected function getLogText( $block, $queryParams, $allLogs, $isnew, $namehidden ) { + if ( empty( $block ) ) { + return ''; + } + # Changes message static $nchanges = array(); static $sinceLastVisitMsg = array();