From: Sébastien Santoro Date: Thu, 28 Jul 2016 00:17:33 +0000 (+0000) Subject: Fix Undefined variable issue in ApiQueryUserContributions X-Git-Tag: 1.31.0-rc.0~6237^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24ze_article%22%29%20.%20%22?a=commitdiff_plain;h=52b9436b69e9dbf95238b150dbdb48f3631ccffa;p=lhc%2Fweb%2Fwiklou.git Fix Undefined variable issue in ApiQueryUserContributions 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 --- 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 ); + } } /**