Jforrester has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405029 )

Change subject: Always pass FileBackend instance to `new FileRepo()`
......................................................................

Always pass FileBackend instance to `new FileRepo()`

Score::$backend is only initialized if Score::getBackend() has been called,
but there are code paths in which getLength() will be called before that
function is ever called. Instead just use Score::getBackend(), which will
lazy-load the backend object, ensuring that we always pass one to FileRepo.

Bug: T185204
Change-Id: Id75c270e1ee49bd94db06c11353b7be9ecb773de
(cherry picked from commit 58e19ece76fa98dad17f63c02dd9d4743f1f9dc2)
---
M includes/Score.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Score 
refs/changes/29/405029/1

diff --git a/includes/Score.php b/includes/Score.php
index ca32ab4..492b14c 100644
--- a/includes/Score.php
+++ b/includes/Score.php
@@ -1034,7 +1034,7 @@
                $isFileMp3 = pathinfo( $path, PATHINFO_EXTENSION ) === 'mp3';
                $repo = new FileRepo( [
                        'name' => 'foo',
-                       'backend' => self::$backend
+                       'backend' => self::getBackend()
                ] );
 
                $f = new UnregisteredLocalFile( false, $repo, $path, $isFileMp3

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id75c270e1ee49bd94db06c11353b7be9ecb773de
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Score
Gerrit-Branch: wmf/1.31.0-wmf.17
Gerrit-Owner: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to