From 4ae160aac7323bdab486933d187252c224ec10c0 Mon Sep 17 00:00:00 2001 From: aude Date: Wed, 4 May 2016 10:47:03 -0400 Subject: [PATCH] If $line is empty in EnhancedChangesList, don't try to access parts of array In getLineData, if the EnhancedChangesListModifyLineData hook returns false, then $line is an empty array and recentChangesFlagsRaw is not set. If $line is empty then presumably we don't want to render it and can skip the line here. Bug: T133296 Change-Id: I92fded07274a06a0dd2929b97815bfe56f1847ea --- includes/changes/EnhancedChangesList.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/includes/changes/EnhancedChangesList.php b/includes/changes/EnhancedChangesList.php index a808516162..1070877c5d 100644 --- a/includes/changes/EnhancedChangesList.php +++ b/includes/changes/EnhancedChangesList.php @@ -262,6 +262,7 @@ class EnhancedChangesList extends ChangesList { if ( !$line ) { // completely ignore this RC entry if we don't want to render it unset( $block[$i] ); + continue; } // Roll up flags @@ -286,6 +287,7 @@ class EnhancedChangesList extends ChangesList { $lines[] = $line; } + // 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 ); -- 2.20.1