SpecialMediaStatistics: Protect against invalid indexes
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 29 May 2015 18:37:34 +0000 (20:37 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Fri, 29 May 2015 18:38:06 +0000 (20:38 +0200)
Avoids Undefined index: \d in
includes/specials/SpecialMediaStatistics.php

Bug: T89534
Follow-Up: Icd06d2b22b1fcb57a8849ef6dc8659b424f27fdc
Change-Id: I21b0bd4329c9b6fa06526326342edddba3f250f6

includes/specials/SpecialMediaStatistics.php

index b62de5d..8f14a41 100644 (file)
@@ -111,7 +111,11 @@ class MediaStatisticsPage extends QueryPage {
        protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
                $prevMediaType = null;
                foreach ( $res as $row ) {
-                       list( $mediaType, $mime, $totalCount, $totalBytes ) = $this->splitFakeTitle( $row->title );
+                       $mediaStats = $this->splitFakeTitle( $row->title );
+                       if ( count( $mediaStats ) < 4 ) {
+                               continue;
+                       }
+                       list( $mediaType, $mime, $totalCount, $totalBytes ) = $mediaStats;
                        if ( $prevMediaType !== $mediaType ) {
                                if ( $prevMediaType !== null ) {
                                        // We're not at beginning, so we have to