From e2379561fab58f9eedd63d73ccc93fe1c0b772e6 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Thu, 12 Feb 2015 11:31:47 -0800 Subject: [PATCH] SpecialMediaStatistics: Protect against invalid indexes Sometimes the full string isn't represented, leading to invalid index access on list() Just default to 0 since it makes sense here Change-Id: Icd06d2b22b1fcb57a8849ef6dc8659b424f27fdc --- includes/specials/SpecialMediaStatistics.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/specials/SpecialMediaStatistics.php b/includes/specials/SpecialMediaStatistics.php index e3c7e3a183..1056cdaea7 100644 --- a/includes/specials/SpecialMediaStatistics.php +++ b/includes/specials/SpecialMediaStatistics.php @@ -322,9 +322,9 @@ class MediaStatisticsPage extends QueryPage { public function preprocessResults( $dbr, $res ) { $this->totalCount = $this->totalBytes = 0; foreach ( $res as $row ) { - list( , , $count, $bytes ) = $this->splitFakeTitle( $row->title ); - $this->totalCount += $count; - $this->totalBytes += $bytes; + $mediaStats = $this->splitFakeTitle( $row->title ); + $this->totalCount += isset( $mediaStats[2] ) ? $mediaStats[2] : 0; + $this->totalBytes += isset( $mediaStats[3] ) ? $mediaStats[3] : 0; } $res->seek( 0 ); } -- 2.20.1