From 52b9436b69e9dbf95238b150dbdb48f3631ccffa Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Santoro?= Date: Thu, 28 Jul 2016 00:17:33 +0000 Subject: [PATCH] Fix Undefined variable issue in ApiQueryUserContributions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Some ApiQueryUserContributions::prepareQuery code paths don't define the $index array, but try to use it anyway. That raises the following notice: Undefined variable: index in …/includes/api/ApiQueryUserContributions.php on line 340 This commit ensures we only try to use the variable when needed. Bug: T141497 Change-Id: Ib9c038b84219bc1886139cb079a33aba74bc5220 --- includes/api/ApiQueryUserContributions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/api/ApiQueryUserContributions.php b/includes/api/ApiQueryUserContributions.php index 60e91e80ec..51e192325e 100644 --- a/includes/api/ApiQueryUserContributions.php +++ b/includes/api/ApiQueryUserContributions.php @@ -337,7 +337,9 @@ class ApiQueryContributions extends ApiQueryBase { $this->addWhereFld( 'ct_tag', $this->params['tag'] ); } - $this->addOption( 'USE INDEX', $index ); + if ( isset( $index ) ) { + $this->addOption( 'USE INDEX', $index ); + } } /** -- 2.20.1