jenkins-bot has submitted this change and it was merged.

Change subject: SpecialMediaStatistics: Protect against invalid indexes
......................................................................


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
---
M includes/specials/SpecialMediaStatistics.php
1 file changed, 3 insertions(+), 3 deletions(-)

Approvals:
  Umherirrender: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialMediaStatistics.php 
b/includes/specials/SpecialMediaStatistics.php
index e3c7e3a..1056cda 100644
--- a/includes/specials/SpecialMediaStatistics.php
+++ b/includes/specials/SpecialMediaStatistics.php
@@ -322,9 +322,9 @@
        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 );
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/190263
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icd06d2b22b1fcb57a8849ef6dc8659b424f27fdc
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to