If $line is empty in EnhancedChangesList, don't try to access parts of array
authoraude <aude.wiki@gmail.com>
Wed, 4 May 2016 14:47:03 +0000 (10:47 -0400)
committerBryanDavis <bdavis@wikimedia.org>
Wed, 4 May 2016 15:57:06 +0000 (15:57 +0000)
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

index a808516..1070877 100644 (file)
@@ -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 );