From c9fedd8fc0c752a7dc3b4b9d2fc292efb4ff917c Mon Sep 17 00:00:00 2001 From: Matthias Mullie Date: Wed, 23 Sep 2015 13:24:34 +0200 Subject: [PATCH] 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 --- includes/changes/EnhancedChangesList.php | 8 ++++++++ 1 file changed, 8 insertions(+) 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(); -- 2.20.1