NewPagesPages: Use array_merge rather than + for RC query info fields
authorBrad Jorsch <bjorsch@wikimedia.org>
Thu, 1 Mar 2018 13:24:48 +0000 (08:24 -0500)
committerAnomie <bjorsch@wikimedia.org>
Thu, 1 Mar 2018 14:22:45 +0000 (14:22 +0000)
Unlike CommentStore::getJoin() and ActorMigration::getJoin(), the tables
and fields of various ::getQueryInfo() methods aren't guaranteed to be
safe to use with array '+'.

Bug: T188555
Change-Id: Ibe99edcb93d1729935fed6232ba4fe2e7d39cea6

includes/specials/pagers/NewPagesPager.php

index 9746334..efdc75a 100644 (file)
@@ -95,9 +95,9 @@ class NewPagesPager extends ReverseChronologicalPager {
 
                // Allow changes to the New Pages query
                $tables = array_merge( $rcQuery['tables'], [ 'page' ] );
-               $fields = [
+               $fields = array_merge( $rcQuery['fields'], [
                        'length' => 'page_len', 'rev_id' => 'page_latest', 'page_namespace', 'page_title'
-               ] + $rcQuery['fields'];
+               ] );
                $join_conds = [ 'page' => [ 'INNER JOIN', 'page_id=rc_cur_id' ] ] + $rcQuery['joins'];
 
                // Avoid PHP 7.1 warning from passing $this by reference